boost-jaeger-client 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
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,84 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.10.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'jaeger/thrift/zipkin/zipkincore_types'
9
+
10
+ module Jaeger
11
+ module Thrift
12
+ module Zipkin
13
+ module ZipkinCollector
14
+ class Client
15
+ include ::Thrift::Client
16
+
17
+ def submitZipkinBatch(spans)
18
+ send_submitZipkinBatch(spans)
19
+ return recv_submitZipkinBatch()
20
+ end
21
+
22
+ def send_submitZipkinBatch(spans)
23
+ send_message('submitZipkinBatch', SubmitZipkinBatch_args, :spans => spans)
24
+ end
25
+
26
+ def recv_submitZipkinBatch()
27
+ result = receive_message(SubmitZipkinBatch_result)
28
+ return result.success unless result.success.nil?
29
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'submitZipkinBatch failed: unknown result')
30
+ end
31
+
32
+ end
33
+
34
+ class Processor
35
+ include ::Thrift::Processor
36
+
37
+ def process_submitZipkinBatch(seqid, iprot, oprot)
38
+ args = read_args(iprot, SubmitZipkinBatch_args)
39
+ result = SubmitZipkinBatch_result.new()
40
+ result.success = @handler.submitZipkinBatch(args.spans)
41
+ write_result(result, oprot, 'submitZipkinBatch', seqid)
42
+ end
43
+
44
+ end
45
+
46
+ # HELPER FUNCTIONS AND STRUCTURES
47
+
48
+ class SubmitZipkinBatch_args
49
+ include ::Thrift::Struct, ::Thrift::Struct_Union
50
+ SPANS = 1
51
+
52
+ FIELDS = {
53
+ SPANS => {:type => ::Thrift::Types::LIST, :name => 'spans', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::Zipkin::Span}}
54
+ }
55
+
56
+ def struct_fields; FIELDS; end
57
+
58
+ def validate
59
+ end
60
+
61
+ ::Thrift::Struct.generate_accessors self
62
+ end
63
+
64
+ class SubmitZipkinBatch_result
65
+ include ::Thrift::Struct, ::Thrift::Struct_Union
66
+ SUCCESS = 0
67
+
68
+ FIELDS = {
69
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::Zipkin::Response}}
70
+ }
71
+
72
+ def struct_fields; FIELDS; end
73
+
74
+ def validate
75
+ end
76
+
77
+ ::Thrift::Struct.generate_accessors self
78
+ end
79
+
80
+ end
81
+
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,41 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.10.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'jaeger/thrift/zipkin/zipkincore_types'
9
+
10
+ module Jaeger
11
+ module Thrift
12
+ module Zipkin
13
+ CLIENT_SEND = %q"cs"
14
+
15
+ CLIENT_RECV = %q"cr"
16
+
17
+ SERVER_SEND = %q"ss"
18
+
19
+ SERVER_RECV = %q"sr"
20
+
21
+ WIRE_SEND = %q"ws"
22
+
23
+ WIRE_RECV = %q"wr"
24
+
25
+ CLIENT_SEND_FRAGMENT = %q"csf"
26
+
27
+ CLIENT_RECV_FRAGMENT = %q"crf"
28
+
29
+ SERVER_SEND_FRAGMENT = %q"ssf"
30
+
31
+ SERVER_RECV_FRAGMENT = %q"srf"
32
+
33
+ LOCAL_COMPONENT = %q"lc"
34
+
35
+ CLIENT_ADDR = %q"ca"
36
+
37
+ SERVER_ADDR = %q"sa"
38
+
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,220 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.10.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+
9
+ module Jaeger
10
+ module Thrift
11
+ module Zipkin
12
+ module AnnotationType
13
+ BOOL = 0
14
+ BYTES = 1
15
+ I16 = 2
16
+ I32 = 3
17
+ I64 = 4
18
+ DOUBLE = 5
19
+ STRING = 6
20
+ VALUE_MAP = {0 => "BOOL", 1 => "BYTES", 2 => "I16", 3 => "I32", 4 => "I64", 5 => "DOUBLE", 6 => "STRING"}
21
+ VALID_VALUES = Set.new([BOOL, BYTES, I16, I32, I64, DOUBLE, STRING]).freeze
22
+ end
23
+
24
+ # Indicates the network context of a service recording an annotation with two
25
+ # exceptions.
26
+ #
27
+ # When a BinaryAnnotation, and key is CLIENT_ADDR or SERVER_ADDR,
28
+ # the endpoint indicates the source or destination of an RPC. This exception
29
+ # allows zipkin to display network context of uninstrumented services, or
30
+ # clients such as web browsers.
31
+ class Endpoint
32
+ include ::Thrift::Struct, ::Thrift::Struct_Union
33
+ IPV4 = 1
34
+ PORT = 2
35
+ SERVICE_NAME = 3
36
+
37
+ FIELDS = {
38
+ # IPv4 host address packed into 4 bytes.
39
+ #
40
+ # Ex for the ip 1.2.3.4, it would be (1 << 24) | (2 << 16) | (3 << 8) | 4
41
+ IPV4 => {:type => ::Thrift::Types::I32, :name => 'ipv4'},
42
+ # IPv4 port
43
+ #
44
+ # Note: this is to be treated as an unsigned integer, so watch for negatives.
45
+ #
46
+ # Conventionally, when the port isn't known, port = 0.
47
+ PORT => {:type => ::Thrift::Types::I16, :name => 'port'},
48
+ # Service name in lowercase, such as "memcache" or "zipkin-web"
49
+ #
50
+ # Conventionally, when the service name isn't known, service_name = "unknown".
51
+ SERVICE_NAME => {:type => ::Thrift::Types::STRING, :name => 'service_name'}
52
+ }
53
+
54
+ def struct_fields; FIELDS; end
55
+
56
+ def validate
57
+ end
58
+
59
+ ::Thrift::Struct.generate_accessors self
60
+ end
61
+
62
+ # An annotation is similar to a log statement. It includes a host field which
63
+ # allows these events to be attributed properly, and also aggregatable.
64
+ class Annotation
65
+ include ::Thrift::Struct, ::Thrift::Struct_Union
66
+ TIMESTAMP = 1
67
+ VALUE = 2
68
+ HOST = 3
69
+
70
+ FIELDS = {
71
+ # Microseconds from epoch.
72
+ #
73
+ # This value should use the most precise value possible. For example,
74
+ # gettimeofday or syncing nanoTime against a tick of currentTimeMillis.
75
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'},
76
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'},
77
+ # Always the host that recorded the event. By specifying the host you allow
78
+ # rollup of all events (such as client requests to a service) by IP address.
79
+ HOST => {:type => ::Thrift::Types::STRUCT, :name => 'host', :class => ::Jaeger::Thrift::Zipkin::Endpoint, :optional => true}
80
+ }
81
+
82
+ def struct_fields; FIELDS; end
83
+
84
+ def validate
85
+ end
86
+
87
+ ::Thrift::Struct.generate_accessors self
88
+ end
89
+
90
+ # Binary annotations are tags applied to a Span to give it context. For
91
+ # example, a binary annotation of "http.uri" could the path to a resource in a
92
+ # RPC call.
93
+ #
94
+ # Binary annotations of type STRING are always queryable, though more a
95
+ # historical implementation detail than a structural concern.
96
+ #
97
+ # Binary annotations can repeat, and vary on the host. Similar to Annotation,
98
+ # the host indicates who logged the event. This allows you to tell the
99
+ # difference between the client and server side of the same key. For example,
100
+ # the key "http.uri" might be different on the client and server side due to
101
+ # rewriting, like "/api/v1/myresource" vs "/myresource. Via the host field,
102
+ # you can see the different points of view, which often help in debugging.
103
+ class BinaryAnnotation
104
+ include ::Thrift::Struct, ::Thrift::Struct_Union
105
+ KEY = 1
106
+ VALUE = 2
107
+ ANNOTATION_TYPE = 3
108
+ HOST = 4
109
+
110
+ FIELDS = {
111
+ KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
112
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true},
113
+ ANNOTATION_TYPE => {:type => ::Thrift::Types::I32, :name => 'annotation_type', :enum_class => ::Jaeger::Thrift::Zipkin::AnnotationType},
114
+ # The host that recorded tag, which allows you to differentiate between
115
+ # multiple tags with the same key. There are two exceptions to this.
116
+ #
117
+ # When the key is CLIENT_ADDR or SERVER_ADDR, host indicates the source or
118
+ # destination of an RPC. This exception allows zipkin to display network
119
+ # context of uninstrumented services, or clients such as web browsers.
120
+ HOST => {:type => ::Thrift::Types::STRUCT, :name => 'host', :class => ::Jaeger::Thrift::Zipkin::Endpoint, :optional => true}
121
+ }
122
+
123
+ def struct_fields; FIELDS; end
124
+
125
+ def validate
126
+ unless @annotation_type.nil? || ::Jaeger::Thrift::Zipkin::AnnotationType::VALID_VALUES.include?(@annotation_type)
127
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field annotation_type!')
128
+ end
129
+ end
130
+
131
+ ::Thrift::Struct.generate_accessors self
132
+ end
133
+
134
+ # A trace is a series of spans (often RPC calls) which form a latency tree.
135
+ #
136
+ # The root span is where trace_id = id and parent_id = Nil. The root span is
137
+ # usually the longest interval in the trace, starting with a SERVER_RECV
138
+ # annotation and ending with a SERVER_SEND.
139
+ class Span
140
+ include ::Thrift::Struct, ::Thrift::Struct_Union
141
+ TRACE_ID = 1
142
+ NAME = 3
143
+ ID = 4
144
+ PARENT_ID = 5
145
+ ANNOTATIONS = 6
146
+ BINARY_ANNOTATIONS = 8
147
+ DEBUG = 9
148
+ TIMESTAMP = 10
149
+ DURATION = 11
150
+
151
+ FIELDS = {
152
+ TRACE_ID => {:type => ::Thrift::Types::I64, :name => 'trace_id'},
153
+ # Span name in lowercase, rpc method for example
154
+ #
155
+ # Conventionally, when the span name isn't known, name = "unknown".
156
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
157
+ ID => {:type => ::Thrift::Types::I64, :name => 'id'},
158
+ PARENT_ID => {:type => ::Thrift::Types::I64, :name => 'parent_id', :optional => true},
159
+ ANNOTATIONS => {:type => ::Thrift::Types::LIST, :name => 'annotations', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::Zipkin::Annotation}},
160
+ BINARY_ANNOTATIONS => {:type => ::Thrift::Types::LIST, :name => 'binary_annotations', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::Zipkin::BinaryAnnotation}},
161
+ DEBUG => {:type => ::Thrift::Types::BOOL, :name => 'debug', :default => false, :optional => true},
162
+ # Microseconds from epoch of the creation of this span.
163
+ #
164
+ # This value should be set directly by instrumentation, using the most
165
+ # precise value possible. For example, gettimeofday or syncing nanoTime
166
+ # against a tick of currentTimeMillis.
167
+ #
168
+ # For compatibilty with instrumentation that precede this field, collectors
169
+ # or span stores can derive this via Annotation.timestamp.
170
+ # For example, SERVER_RECV.timestamp or CLIENT_SEND.timestamp.
171
+ #
172
+ # This field is optional for compatibility with old data: first-party span
173
+ # stores are expected to support this at time of introduction.
174
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp', :optional => true},
175
+ # Measurement of duration in microseconds, used to support queries.
176
+ #
177
+ # This value should be set directly, where possible. Doing so encourages
178
+ # precise measurement decoupled from problems of clocks, such as skew or NTP
179
+ # updates causing time to move backwards.
180
+ #
181
+ # For compatibilty with instrumentation that precede this field, collectors
182
+ # or span stores can derive this by subtracting Annotation.timestamp.
183
+ # For example, SERVER_SEND.timestamp - SERVER_RECV.timestamp.
184
+ #
185
+ # If this field is persisted as unset, zipkin will continue to work, except
186
+ # duration query support will be implementation-specific. Similarly, setting
187
+ # this field non-atomically is implementation-specific.
188
+ #
189
+ # This field is i64 vs i32 to support spans longer than 35 minutes.
190
+ DURATION => {:type => ::Thrift::Types::I64, :name => 'duration', :optional => true}
191
+ }
192
+
193
+ def struct_fields; FIELDS; end
194
+
195
+ def validate
196
+ end
197
+
198
+ ::Thrift::Struct.generate_accessors self
199
+ end
200
+
201
+ class Response
202
+ include ::Thrift::Struct, ::Thrift::Struct_Union
203
+ OK = 1
204
+
205
+ FIELDS = {
206
+ OK => {:type => ::Thrift::Types::BOOL, :name => 'ok'}
207
+ }
208
+
209
+ def struct_fields; FIELDS; end
210
+
211
+ def validate
212
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field ok is unset!') if @ok.nil?
213
+ end
214
+
215
+ ::Thrift::Struct.generate_accessors self
216
+ end
217
+
218
+ end
219
+ end
220
+ end
@@ -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
+ }