boost-jaeger-client 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +47 -0
  5. data/.travis.yml +5 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +57 -0
  9. data/Rakefile +9 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/boost-jaeger-client.gemspec +31 -0
  13. data/lib/jaeger/client/carrier.rb +26 -0
  14. data/lib/jaeger/client/collector.rb +91 -0
  15. data/lib/jaeger/client/samplers/const.rb +29 -0
  16. data/lib/jaeger/client/samplers/probabilistic.rb +30 -0
  17. data/lib/jaeger/client/samplers.rb +4 -0
  18. data/lib/jaeger/client/scope.rb +40 -0
  19. data/lib/jaeger/client/scope_manager/scope_identifier.rb +15 -0
  20. data/lib/jaeger/client/scope_manager/scope_stack.rb +35 -0
  21. data/lib/jaeger/client/scope_manager.rb +49 -0
  22. data/lib/jaeger/client/span/thrift_log_builder.rb +20 -0
  23. data/lib/jaeger/client/span/thrift_tag_builder.rb +45 -0
  24. data/lib/jaeger/client/span.rb +83 -0
  25. data/lib/jaeger/client/span_context.rb +78 -0
  26. data/lib/jaeger/client/trace_id.rb +13 -0
  27. data/lib/jaeger/client/tracer.rb +220 -0
  28. data/lib/jaeger/client/udp_sender/transport.rb +42 -0
  29. data/lib/jaeger/client/udp_sender.rb +82 -0
  30. data/lib/jaeger/client/version.rb +7 -0
  31. data/lib/jaeger/client.rb +44 -0
  32. data/script/create_follows_from_trace +52 -0
  33. data/script/create_trace +53 -0
  34. data/thrift/agent.thrift +32 -0
  35. data/thrift/gen-rb/jaeger/thrift/agent/agent.rb +118 -0
  36. data/thrift/gen-rb/jaeger/thrift/agent/agent_constants.rb +15 -0
  37. data/thrift/gen-rb/jaeger/thrift/agent/agent_types.rb +17 -0
  38. data/thrift/gen-rb/jaeger/thrift/agent.rb +116 -0
  39. data/thrift/gen-rb/jaeger/thrift/agent_constants.rb +13 -0
  40. data/thrift/gen-rb/jaeger/thrift/agent_types.rb +15 -0
  41. data/thrift/gen-rb/jaeger/thrift/collector.rb +82 -0
  42. data/thrift/gen-rb/jaeger/thrift/jaeger_constants.rb +13 -0
  43. data/thrift/gen-rb/jaeger/thrift/jaeger_types.rb +211 -0
  44. data/thrift/gen-rb/jaeger/thrift/zipkin/zipkin_collector.rb +84 -0
  45. data/thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_constants.rb +41 -0
  46. data/thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_types.rb +220 -0
  47. data/thrift/jaeger.thrift +88 -0
  48. data/thrift/zipkincore.thrift +300 -0
  49. metadata +190 -0
@@ -0,0 +1,300 @@
1
+ # Copyright 2012 Twitter Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ namespace java com.twitter.zipkin.thriftjava
15
+ #@namespace scala com.twitter.zipkin.thriftscala
16
+ namespace rb Jaeger.Thrift.Zipkin
17
+
18
+ #************** Annotation.value **************
19
+ /**
20
+ * The client sent ("cs") a request to a server. There is only one send per
21
+ * span. For example, if there's a transport error, each attempt can be logged
22
+ * as a WIRE_SEND annotation.
23
+ *
24
+ * If chunking is involved, each chunk could be logged as a separate
25
+ * CLIENT_SEND_FRAGMENT in the same span.
26
+ *
27
+ * Annotation.host is not the server. It is the host which logged the send
28
+ * event, almost always the client. When logging CLIENT_SEND, instrumentation
29
+ * should also log the SERVER_ADDR.
30
+ */
31
+ const string CLIENT_SEND = "cs"
32
+ /**
33
+ * The client received ("cr") a response from a server. There is only one
34
+ * receive per span. For example, if duplicate responses were received, each
35
+ * can be logged as a WIRE_RECV annotation.
36
+ *
37
+ * If chunking is involved, each chunk could be logged as a separate
38
+ * CLIENT_RECV_FRAGMENT in the same span.
39
+ *
40
+ * Annotation.host is not the server. It is the host which logged the receive
41
+ * event, almost always the client. The actual endpoint of the server is
42
+ * recorded separately as SERVER_ADDR when CLIENT_SEND is logged.
43
+ */
44
+ const string CLIENT_RECV = "cr"
45
+ /**
46
+ * The server sent ("ss") a response to a client. There is only one response
47
+ * per span. If there's a transport error, each attempt can be logged as a
48
+ * WIRE_SEND annotation.
49
+ *
50
+ * Typically, a trace ends with a server send, so the last timestamp of a trace
51
+ * is often the timestamp of the root span's server send.
52
+ *
53
+ * If chunking is involved, each chunk could be logged as a separate
54
+ * SERVER_SEND_FRAGMENT in the same span.
55
+ *
56
+ * Annotation.host is not the client. It is the host which logged the send
57
+ * event, almost always the server. The actual endpoint of the client is
58
+ * recorded separately as CLIENT_ADDR when SERVER_RECV is logged.
59
+ */
60
+ const string SERVER_SEND = "ss"
61
+ /**
62
+ * The server received ("sr") a request from a client. There is only one
63
+ * request per span. For example, if duplicate responses were received, each
64
+ * can be logged as a WIRE_RECV annotation.
65
+ *
66
+ * Typically, a trace starts with a server receive, so the first timestamp of a
67
+ * trace is often the timestamp of the root span's server receive.
68
+ *
69
+ * If chunking is involved, each chunk could be logged as a separate
70
+ * SERVER_RECV_FRAGMENT in the same span.
71
+ *
72
+ * Annotation.host is not the client. It is the host which logged the receive
73
+ * event, almost always the server. When logging SERVER_RECV, instrumentation
74
+ * should also log the CLIENT_ADDR.
75
+ */
76
+ const string SERVER_RECV = "sr"
77
+ /**
78
+ * Optionally logs an attempt to send a message on the wire. Multiple wire send
79
+ * events could indicate network retries. A lag between client or server send
80
+ * and wire send might indicate queuing or processing delay.
81
+ */
82
+ const string WIRE_SEND = "ws"
83
+ /**
84
+ * Optionally logs an attempt to receive a message from the wire. Multiple wire
85
+ * receive events could indicate network retries. A lag between wire receive
86
+ * and client or server receive might indicate queuing or processing delay.
87
+ */
88
+ const string WIRE_RECV = "wr"
89
+ /**
90
+ * Optionally logs progress of a (CLIENT_SEND, WIRE_SEND). For example, this
91
+ * could be one chunk in a chunked request.
92
+ */
93
+ const string CLIENT_SEND_FRAGMENT = "csf"
94
+ /**
95
+ * Optionally logs progress of a (CLIENT_RECV, WIRE_RECV). For example, this
96
+ * could be one chunk in a chunked response.
97
+ */
98
+ const string CLIENT_RECV_FRAGMENT = "crf"
99
+ /**
100
+ * Optionally logs progress of a (SERVER_SEND, WIRE_SEND). For example, this
101
+ * could be one chunk in a chunked response.
102
+ */
103
+ const string SERVER_SEND_FRAGMENT = "ssf"
104
+ /**
105
+ * Optionally logs progress of a (SERVER_RECV, WIRE_RECV). For example, this
106
+ * could be one chunk in a chunked request.
107
+ */
108
+ const string SERVER_RECV_FRAGMENT = "srf"
109
+
110
+ #***** BinaryAnnotation.key ******
111
+ /**
112
+ * The value of "lc" is the component or namespace of a local span.
113
+ *
114
+ * BinaryAnnotation.host adds service context needed to support queries.
115
+ *
116
+ * Local Component("lc") supports three key features: flagging, query by
117
+ * service and filtering Span.name by namespace.
118
+ *
119
+ * While structurally the same, local spans are fundamentally different than
120
+ * RPC spans in how they should be interpreted. For example, zipkin v1 tools
121
+ * center on RPC latency and service graphs. Root local-spans are neither
122
+ * indicative of critical path RPC latency, nor have impact on the shape of a
123
+ * service graph. By flagging with "lc", tools can special-case local spans.
124
+ *
125
+ * Zipkin v1 Spans are unqueryable unless they can be indexed by service name.
126
+ * The only path to a service name is by (Binary)?Annotation.host.serviceName.
127
+ * By logging "lc", a local span can be queried even if no other annotations
128
+ * are logged.
129
+ *
130
+ * The value of "lc" is the namespace of Span.name. For example, it might be
131
+ * "finatra2", for a span named "bootstrap". "lc" allows you to resolves
132
+ * conflicts for the same Span.name, for example "finatra/bootstrap" vs
133
+ * "finch/bootstrap". Using local component, you'd search for spans named
134
+ * "bootstrap" where "lc=finch"
135
+ */
136
+ const string LOCAL_COMPONENT = "lc"
137
+
138
+ #***** BinaryAnnotation.key where value = [1] and annotation_type = BOOL ******
139
+ /**
140
+ * Indicates a client address ("ca") in a span. Most likely, there's only one.
141
+ * Multiple addresses are possible when a client changes its ip or port within
142
+ * a span.
143
+ */
144
+ const string CLIENT_ADDR = "ca"
145
+ /**
146
+ * Indicates a server address ("sa") in a span. Most likely, there's only one.
147
+ * Multiple addresses are possible when a client is redirected, or fails to a
148
+ * different server ip or port.
149
+ */
150
+ const string SERVER_ADDR = "sa"
151
+
152
+ /**
153
+ * Indicates the network context of a service recording an annotation with two
154
+ * exceptions.
155
+ *
156
+ * When a BinaryAnnotation, and key is CLIENT_ADDR or SERVER_ADDR,
157
+ * the endpoint indicates the source or destination of an RPC. This exception
158
+ * allows zipkin to display network context of uninstrumented services, or
159
+ * clients such as web browsers.
160
+ */
161
+ struct Endpoint {
162
+ /**
163
+ * IPv4 host address packed into 4 bytes.
164
+ *
165
+ * Ex for the ip 1.2.3.4, it would be (1 << 24) | (2 << 16) | (3 << 8) | 4
166
+ */
167
+ 1: i32 ipv4
168
+ /**
169
+ * IPv4 port
170
+ *
171
+ * Note: this is to be treated as an unsigned integer, so watch for negatives.
172
+ *
173
+ * Conventionally, when the port isn't known, port = 0.
174
+ */
175
+ 2: i16 port
176
+ /**
177
+ * Service name in lowercase, such as "memcache" or "zipkin-web"
178
+ *
179
+ * Conventionally, when the service name isn't known, service_name = "unknown".
180
+ */
181
+ 3: string service_name
182
+ }
183
+
184
+ /**
185
+ * An annotation is similar to a log statement. It includes a host field which
186
+ * allows these events to be attributed properly, and also aggregatable.
187
+ */
188
+ struct Annotation {
189
+ /**
190
+ * Microseconds from epoch.
191
+ *
192
+ * This value should use the most precise value possible. For example,
193
+ * gettimeofday or syncing nanoTime against a tick of currentTimeMillis.
194
+ */
195
+ 1: i64 timestamp
196
+ 2: string value // what happened at the timestamp?
197
+ /**
198
+ * Always the host that recorded the event. By specifying the host you allow
199
+ * rollup of all events (such as client requests to a service) by IP address.
200
+ */
201
+ 3: optional Endpoint host
202
+ // don't reuse 4: optional i32 OBSOLETE_duration // how long did the operation take? microseconds
203
+ }
204
+
205
+ enum AnnotationType { BOOL, BYTES, I16, I32, I64, DOUBLE, STRING }
206
+
207
+ /**
208
+ * Binary annotations are tags applied to a Span to give it context. For
209
+ * example, a binary annotation of "http.uri" could the path to a resource in a
210
+ * RPC call.
211
+ *
212
+ * Binary annotations of type STRING are always queryable, though more a
213
+ * historical implementation detail than a structural concern.
214
+ *
215
+ * Binary annotations can repeat, and vary on the host. Similar to Annotation,
216
+ * the host indicates who logged the event. This allows you to tell the
217
+ * difference between the client and server side of the same key. For example,
218
+ * the key "http.uri" might be different on the client and server side due to
219
+ * rewriting, like "/api/v1/myresource" vs "/myresource. Via the host field,
220
+ * you can see the different points of view, which often help in debugging.
221
+ */
222
+ struct BinaryAnnotation {
223
+ 1: string key,
224
+ 2: binary value,
225
+ 3: AnnotationType annotation_type,
226
+ /**
227
+ * The host that recorded tag, which allows you to differentiate between
228
+ * multiple tags with the same key. There are two exceptions to this.
229
+ *
230
+ * When the key is CLIENT_ADDR or SERVER_ADDR, host indicates the source or
231
+ * destination of an RPC. This exception allows zipkin to display network
232
+ * context of uninstrumented services, or clients such as web browsers.
233
+ */
234
+ 4: optional Endpoint host
235
+ }
236
+
237
+ /**
238
+ * A trace is a series of spans (often RPC calls) which form a latency tree.
239
+ *
240
+ * The root span is where trace_id = id and parent_id = Nil. The root span is
241
+ * usually the longest interval in the trace, starting with a SERVER_RECV
242
+ * annotation and ending with a SERVER_SEND.
243
+ */
244
+ struct Span {
245
+ 1: i64 trace_id # unique trace id, use for all spans in trace
246
+ /**
247
+ * Span name in lowercase, rpc method for example
248
+ *
249
+ * Conventionally, when the span name isn't known, name = "unknown".
250
+ */
251
+ 3: string name,
252
+ 4: i64 id, # unique span id, only used for this span
253
+ 5: optional i64 parent_id, # parent span id
254
+ 6: list<Annotation> annotations, # all annotations/events that occured, sorted by timestamp
255
+ 8: list<BinaryAnnotation> binary_annotations # any binary annotations
256
+ 9: optional bool debug = 0 # if true, we DEMAND that this span passes all samplers
257
+ /**
258
+ * Microseconds from epoch of the creation of this span.
259
+ *
260
+ * This value should be set directly by instrumentation, using the most
261
+ * precise value possible. For example, gettimeofday or syncing nanoTime
262
+ * against a tick of currentTimeMillis.
263
+ *
264
+ * For compatibilty with instrumentation that precede this field, collectors
265
+ * or span stores can derive this via Annotation.timestamp.
266
+ * For example, SERVER_RECV.timestamp or CLIENT_SEND.timestamp.
267
+ *
268
+ * This field is optional for compatibility with old data: first-party span
269
+ * stores are expected to support this at time of introduction.
270
+ */
271
+ 10: optional i64 timestamp,
272
+ /**
273
+ * Measurement of duration in microseconds, used to support queries.
274
+ *
275
+ * This value should be set directly, where possible. Doing so encourages
276
+ * precise measurement decoupled from problems of clocks, such as skew or NTP
277
+ * updates causing time to move backwards.
278
+ *
279
+ * For compatibilty with instrumentation that precede this field, collectors
280
+ * or span stores can derive this by subtracting Annotation.timestamp.
281
+ * For example, SERVER_SEND.timestamp - SERVER_RECV.timestamp.
282
+ *
283
+ * If this field is persisted as unset, zipkin will continue to work, except
284
+ * duration query support will be implementation-specific. Similarly, setting
285
+ * this field non-atomically is implementation-specific.
286
+ *
287
+ * This field is i64 vs i32 to support spans longer than 35 minutes.
288
+ */
289
+ 11: optional i64 duration
290
+ }
291
+
292
+ # define TChannel service
293
+
294
+ struct Response {
295
+ 1: required bool ok
296
+ }
297
+
298
+ service ZipkinCollector {
299
+ list<Response> submitZipkinBatch(1: list<Span> spans)
300
+ }
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: boost-jaeger-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.0
5
+ platform: ruby
6
+ authors:
7
+ - kruczjak
8
+ - SaleMove TechMovers
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2018-07-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.14'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.14'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '10.0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '10.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '3.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '3.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rubocop
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 0.54.0
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.54.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: rubocop-rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: 1.24.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 1.24.0
84
+ - !ruby/object:Gem::Dependency
85
+ name: opentracing
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '0.3'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '0.3'
98
+ - !ruby/object:Gem::Dependency
99
+ name: thrift
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ description: ''
113
+ email:
114
+ - kruczjak@gmail.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".rubocop.yml"
122
+ - ".travis.yml"
123
+ - Gemfile
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/setup
129
+ - boost-jaeger-client.gemspec
130
+ - lib/jaeger/client.rb
131
+ - lib/jaeger/client/carrier.rb
132
+ - lib/jaeger/client/collector.rb
133
+ - lib/jaeger/client/samplers.rb
134
+ - lib/jaeger/client/samplers/const.rb
135
+ - lib/jaeger/client/samplers/probabilistic.rb
136
+ - lib/jaeger/client/scope.rb
137
+ - lib/jaeger/client/scope_manager.rb
138
+ - lib/jaeger/client/scope_manager/scope_identifier.rb
139
+ - lib/jaeger/client/scope_manager/scope_stack.rb
140
+ - lib/jaeger/client/span.rb
141
+ - lib/jaeger/client/span/thrift_log_builder.rb
142
+ - lib/jaeger/client/span/thrift_tag_builder.rb
143
+ - lib/jaeger/client/span_context.rb
144
+ - lib/jaeger/client/trace_id.rb
145
+ - lib/jaeger/client/tracer.rb
146
+ - lib/jaeger/client/udp_sender.rb
147
+ - lib/jaeger/client/udp_sender/transport.rb
148
+ - lib/jaeger/client/version.rb
149
+ - script/create_follows_from_trace
150
+ - script/create_trace
151
+ - thrift/agent.thrift
152
+ - thrift/gen-rb/jaeger/thrift/agent.rb
153
+ - thrift/gen-rb/jaeger/thrift/agent/agent.rb
154
+ - thrift/gen-rb/jaeger/thrift/agent/agent_constants.rb
155
+ - thrift/gen-rb/jaeger/thrift/agent/agent_types.rb
156
+ - thrift/gen-rb/jaeger/thrift/agent_constants.rb
157
+ - thrift/gen-rb/jaeger/thrift/agent_types.rb
158
+ - thrift/gen-rb/jaeger/thrift/collector.rb
159
+ - thrift/gen-rb/jaeger/thrift/jaeger_constants.rb
160
+ - thrift/gen-rb/jaeger/thrift/jaeger_types.rb
161
+ - thrift/gen-rb/jaeger/thrift/zipkin/zipkin_collector.rb
162
+ - thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_constants.rb
163
+ - thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_types.rb
164
+ - thrift/jaeger.thrift
165
+ - thrift/zipkincore.thrift
166
+ homepage: ''
167
+ licenses:
168
+ - MIT
169
+ metadata: {}
170
+ post_install_message:
171
+ rdoc_options: []
172
+ require_paths:
173
+ - lib
174
+ required_ruby_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ requirements: []
185
+ rubyforge_project:
186
+ rubygems_version: 2.7.7
187
+ signing_key:
188
+ specification_version: 4
189
+ summary: OpenTracing Tracer implementation for Jaeger in Ruby
190
+ test_files: []