jaeger-client 0.1.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.
@@ -0,0 +1,88 @@
1
+ # Copyright (c) 2016 Uber Technologies, Inc.
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ namespace java com.uber.jaeger.thriftjava
22
+ namespace rb Jaeger.Thrift
23
+
24
+ # TagType denotes the type of a Tag's value.
25
+ enum TagType { STRING, DOUBLE, BOOL, LONG, BINARY }
26
+
27
+ # Tag is a basic strongly typed key/value pair. It has been flattened to reduce the use of pointers in golang
28
+ struct Tag {
29
+ 1: required string key
30
+ 2: required TagType vType
31
+ 3: optional string vStr
32
+ 4: optional double vDouble
33
+ 5: optional bool vBool
34
+ 6: optional i64 vLong
35
+ 7: optional binary vBinary
36
+ }
37
+
38
+ # Log is a timed even with an arbitrary set of tags.
39
+ struct Log {
40
+ 1: required i64 timestamp
41
+ 2: required list<Tag> fields
42
+ }
43
+
44
+ enum SpanRefType { CHILD_OF, FOLLOWS_FROM }
45
+
46
+ # SpanRef describes causal relationship of the current span to another span (e.g. 'child-of')
47
+ struct SpanRef {
48
+ 1: required SpanRefType refType
49
+ 2: required i64 traceIdLow
50
+ 3: required i64 traceIdHigh
51
+ 4: required i64 spanId
52
+ }
53
+
54
+ # Span represents a named unit of work performed by a service.
55
+ struct Span {
56
+ 1: required i64 traceIdLow # the least significant 64 bits of a traceID
57
+ 2: required i64 traceIdHigh # the most significant 64 bits of a traceID; 0 when only 64bit IDs are used
58
+ 3: required i64 spanId # unique span id (only unique within a given trace)
59
+ 4: required i64 parentSpanId # since nearly all spans will have parents spans, CHILD_OF refs do not have to be explicit
60
+ 5: required string operationName
61
+ 6: optional list<SpanRef> references # causal references to other spans
62
+ 7: required i32 flags # tbd
63
+ 8: required i64 startTime
64
+ 9: required i64 duration
65
+ 10: optional list<Tag> tags
66
+ 11: optional list<Log> logs
67
+ }
68
+
69
+ # Process describes the traced process/service that emits spans.
70
+ struct Process {
71
+ 1: required string serviceName
72
+ 2: optional list<Tag> tags
73
+ }
74
+
75
+ # Batch is a collection of spans reported out of process.
76
+ struct Batch {
77
+ 1: required Process process
78
+ 2: required list<Span> spans
79
+ }
80
+
81
+ # BatchSubmitResponse is the response on submitting a batch.
82
+ struct BatchSubmitResponse {
83
+ 1: required bool ok # The Collector's client is expected to only log (or emit a counter) when not ok equals false
84
+ }
85
+
86
+ service Collector {
87
+ list<BatchSubmitResponse> submitBatches(1: list<Batch> batches)
88
+ }
@@ -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,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jaeger-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - SaleMove TechMovers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: opentracing
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: thrift
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: ''
84
+ email:
85
+ - techmovers@salemove.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - jaeger-client.gemspec
100
+ - lib/jaeger/client.rb
101
+ - lib/jaeger/client/carrier.rb
102
+ - lib/jaeger/client/span.rb
103
+ - lib/jaeger/client/span_context.rb
104
+ - lib/jaeger/client/trace_id.rb
105
+ - lib/jaeger/client/tracer.rb
106
+ - lib/jaeger/client/udp_sender.rb
107
+ - script/create_trace
108
+ - thrift/agent.thrift
109
+ - thrift/gen-rb/jaeger/thrift/agent.rb
110
+ - thrift/gen-rb/jaeger/thrift/agent/agent.rb
111
+ - thrift/gen-rb/jaeger/thrift/agent/agent_constants.rb
112
+ - thrift/gen-rb/jaeger/thrift/agent/agent_types.rb
113
+ - thrift/gen-rb/jaeger/thrift/agent_constants.rb
114
+ - thrift/gen-rb/jaeger/thrift/agent_types.rb
115
+ - thrift/gen-rb/jaeger/thrift/collector.rb
116
+ - thrift/gen-rb/jaeger/thrift/jaeger_constants.rb
117
+ - thrift/gen-rb/jaeger/thrift/jaeger_types.rb
118
+ - thrift/gen-rb/jaeger/thrift/zipkin/zipkin_collector.rb
119
+ - thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_constants.rb
120
+ - thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_types.rb
121
+ - thrift/jaeger.thrift
122
+ - thrift/zipkincore.thrift
123
+ homepage: ''
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 2.6.8
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: OpenTracing Tracer implementation for Jaeger in Ruby
147
+ test_files: []