dox-jaeger-client 2.0.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 (75) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +33 -0
  3. data/.gitignore +12 -0
  4. data/.gitmodules +3 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +61 -0
  7. data/.rubocop_todo.yml +13 -0
  8. data/Gemfile +4 -0
  9. data/LICENSE.txt +21 -0
  10. data/Makefile +1 -0
  11. data/README.md +210 -0
  12. data/Rakefile +9 -0
  13. data/bin/console +14 -0
  14. data/bin/setup +8 -0
  15. data/crossdock/Dockerfile +31 -0
  16. data/crossdock/Gemfile +6 -0
  17. data/crossdock/Gemfile.lock +37 -0
  18. data/crossdock/docker-compose.yml +68 -0
  19. data/crossdock/jaeger-docker-compose.yml +53 -0
  20. data/crossdock/rules.mk +35 -0
  21. data/crossdock/server +175 -0
  22. data/jaeger-client.gemspec +37 -0
  23. data/lib/jaeger/client/version.rb +7 -0
  24. data/lib/jaeger/client.rb +77 -0
  25. data/lib/jaeger/encoders/thrift_encoder.rb +173 -0
  26. data/lib/jaeger/extractors.rb +173 -0
  27. data/lib/jaeger/http_sender.rb +28 -0
  28. data/lib/jaeger/injectors.rb +83 -0
  29. data/lib/jaeger/rate_limiter.rb +61 -0
  30. data/lib/jaeger/recurring_executor.rb +35 -0
  31. data/lib/jaeger/reporters/composite_reporter.rb +17 -0
  32. data/lib/jaeger/reporters/in_memory_reporter.rb +30 -0
  33. data/lib/jaeger/reporters/logging_reporter.rb +22 -0
  34. data/lib/jaeger/reporters/null_reporter.rb +11 -0
  35. data/lib/jaeger/reporters/remote_reporter/buffer.rb +29 -0
  36. data/lib/jaeger/reporters/remote_reporter.rb +42 -0
  37. data/lib/jaeger/reporters.rb +7 -0
  38. data/lib/jaeger/samplers/const.rb +24 -0
  39. data/lib/jaeger/samplers/guaranteed_throughput_probabilistic.rb +47 -0
  40. data/lib/jaeger/samplers/per_operation.rb +77 -0
  41. data/lib/jaeger/samplers/probabilistic.rb +40 -0
  42. data/lib/jaeger/samplers/rate_limiting.rb +51 -0
  43. data/lib/jaeger/samplers/remote_controlled/instructions_fetcher.rb +34 -0
  44. data/lib/jaeger/samplers/remote_controlled.rb +119 -0
  45. data/lib/jaeger/samplers.rb +8 -0
  46. data/lib/jaeger/scope.rb +39 -0
  47. data/lib/jaeger/scope_manager/scope_identifier.rb +13 -0
  48. data/lib/jaeger/scope_manager/scope_stack.rb +33 -0
  49. data/lib/jaeger/scope_manager.rb +48 -0
  50. data/lib/jaeger/span/thrift_log_builder.rb +18 -0
  51. data/lib/jaeger/span.rb +97 -0
  52. data/lib/jaeger/span_context.rb +57 -0
  53. data/lib/jaeger/thrift_tag_builder.rb +42 -0
  54. data/lib/jaeger/trace_id.rb +48 -0
  55. data/lib/jaeger/tracer.rb +214 -0
  56. data/lib/jaeger/udp_sender/transport.rb +41 -0
  57. data/lib/jaeger/udp_sender.rb +26 -0
  58. data/script/create_follows_from_trace +51 -0
  59. data/script/create_trace +52 -0
  60. data/thrift/agent.thrift +32 -0
  61. data/thrift/gen-rb/jaeger/thrift/agent/agent.rb +118 -0
  62. data/thrift/gen-rb/jaeger/thrift/agent/agent_constants.rb +15 -0
  63. data/thrift/gen-rb/jaeger/thrift/agent/agent_types.rb +17 -0
  64. data/thrift/gen-rb/jaeger/thrift/agent.rb +116 -0
  65. data/thrift/gen-rb/jaeger/thrift/agent_constants.rb +13 -0
  66. data/thrift/gen-rb/jaeger/thrift/agent_types.rb +15 -0
  67. data/thrift/gen-rb/jaeger/thrift/collector.rb +82 -0
  68. data/thrift/gen-rb/jaeger/thrift/jaeger_constants.rb +13 -0
  69. data/thrift/gen-rb/jaeger/thrift/jaeger_types.rb +211 -0
  70. data/thrift/gen-rb/jaeger/thrift/zipkin/zipkin_collector.rb +84 -0
  71. data/thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_constants.rb +41 -0
  72. data/thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_types.rb +220 -0
  73. data/thrift/jaeger.thrift +88 -0
  74. data/thrift/zipkincore.thrift +300 -0
  75. metadata +260 -0
@@ -0,0 +1,214 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jaeger
4
+ class Tracer
5
+ def initialize(reporter:, sampler:, injectors:, extractors:)
6
+ @reporter = reporter
7
+ @sampler = sampler
8
+ @injectors = injectors
9
+ @extractors = extractors
10
+ @scope_manager = ScopeManager.new
11
+ end
12
+
13
+ # @return [ScopeManager] the current ScopeManager, which may be a no-op
14
+ # but may not be nil.
15
+ attr_reader :scope_manager
16
+
17
+ # @return [Span, nil] the active span. This is a shorthand for
18
+ # `scope_manager.active.span`, and nil will be returned if
19
+ # Scope#active is nil.
20
+ def active_span
21
+ scope = scope_manager.active
22
+ scope&.span
23
+ end
24
+
25
+ # Starts a new span.
26
+ #
27
+ # This is similar to #start_active_span, but the returned Span will not
28
+ # be registered via the ScopeManager.
29
+ #
30
+ # @param operation_name [String] The operation name for the Span
31
+ # @param child_of [SpanContext, Span] SpanContext that acts as a parent to
32
+ # the newly-started Span. If a Span instance is provided, its
33
+ # context is automatically substituted. See [Reference] for more
34
+ # information.
35
+ #
36
+ # If specified, the `references` parameter must be omitted.
37
+ # @param references [Array<Reference>] An array of reference
38
+ # objects that identify one or more parent SpanContexts.
39
+ # @param start_time [Time] When the Span started, if not now
40
+ # @param tags [Hash] Tags to assign to the Span at start time
41
+ # @param ignore_active_scope [Boolean] whether to create an implicit
42
+ # References#CHILD_OF reference to the ScopeManager#active.
43
+ #
44
+ # @yield [Span] If passed an optional block, start_span will yield the
45
+ # newly-created span to the block. The span will be finished automatically
46
+ # after the block is executed.
47
+ # @return [Span, Object] If passed an optional block, start_span will return
48
+ # the block's return value, otherwise it returns the newly-started Span
49
+ # instance, which has not been automatically registered via the
50
+ # ScopeManager
51
+ def start_span(operation_name,
52
+ child_of: nil,
53
+ references: nil,
54
+ start_time: Time.now,
55
+ tags: {},
56
+ ignore_active_scope: false,
57
+ **)
58
+ context, sampler_tags = prepare_span_context(
59
+ operation_name: operation_name,
60
+ child_of: child_of,
61
+ references: references,
62
+ ignore_active_scope: ignore_active_scope
63
+ )
64
+ span = Span.new(
65
+ context,
66
+ operation_name,
67
+ @reporter,
68
+ start_time: start_time,
69
+ references: references,
70
+ tags: tags.merge(sampler_tags)
71
+ )
72
+
73
+ if block_given?
74
+ begin
75
+ yield(span)
76
+ ensure
77
+ span.finish
78
+ end
79
+ else
80
+ span
81
+ end
82
+ end
83
+
84
+ # Creates a newly started and activated Scope
85
+ #
86
+ # If the Tracer's ScopeManager#active is not nil, no explicit references
87
+ # are provided, and `ignore_active_scope` is false, then an inferred
88
+ # References#CHILD_OF reference is created to the ScopeManager#active's
89
+ # SpanContext when start_active is invoked.
90
+ #
91
+ # @param operation_name [String] The operation name for the Span
92
+ # @param child_of [SpanContext, Span] SpanContext that acts as a parent to
93
+ # the newly-started Span. If a Span instance is provided, its
94
+ # context is automatically substituted. See [Reference] for more
95
+ # information.
96
+ #
97
+ # If specified, the `references` parameter must be omitted.
98
+ # @param references [Array<Reference>] An array of reference
99
+ # objects that identify one or more parent SpanContexts.
100
+ # @param start_time [Time] When the Span started, if not now
101
+ # @param tags [Hash] Tags to assign to the Span at start time
102
+ # @param ignore_active_scope [Boolean] whether to create an implicit
103
+ # References#CHILD_OF reference to the ScopeManager#active.
104
+ # @param finish_on_close [Boolean] whether span should automatically be
105
+ # finished when Scope#close is called
106
+ # @yield [Scope] If an optional block is passed to start_active_span it
107
+ # will yield the newly-started Scope. If `finish_on_close` is true then the
108
+ # Span will be finished automatically after the block is executed.
109
+ # @return [Scope, Object] If passed an optional block, start_active_span
110
+ # returns the block's return value, otherwise it returns the newly-started
111
+ # and activated Scope
112
+ def start_active_span(operation_name,
113
+ child_of: nil,
114
+ references: nil,
115
+ start_time: Time.now,
116
+ tags: {},
117
+ ignore_active_scope: false,
118
+ finish_on_close: true,
119
+ **)
120
+ span = start_span(
121
+ operation_name,
122
+ child_of: child_of,
123
+ references: references,
124
+ start_time: start_time,
125
+ tags: tags,
126
+ ignore_active_scope: ignore_active_scope
127
+ )
128
+ scope = @scope_manager.activate(span, finish_on_close: finish_on_close)
129
+
130
+ if block_given?
131
+ begin
132
+ yield scope
133
+ ensure
134
+ scope.close
135
+ end
136
+ else
137
+ scope
138
+ end
139
+ end
140
+
141
+ # Inject a SpanContext into the given carrier
142
+ #
143
+ # @param span_context [SpanContext]
144
+ # @param format [OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY, OpenTracing::FORMAT_RACK]
145
+ # @param carrier [Carrier] A carrier object of the type dictated by the specified `format`
146
+ def inject(span_context, format, carrier)
147
+ @injectors.fetch(format).each do |injector|
148
+ injector.inject(span_context, carrier)
149
+ end
150
+ end
151
+
152
+ # Extract a SpanContext in the given format from the given carrier.
153
+ #
154
+ # @param format [OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY, OpenTracing::FORMAT_RACK]
155
+ # @param carrier [Carrier] A carrier object of the type dictated by the specified `format`
156
+ # @return [SpanContext] the extracted SpanContext or nil if none could be found
157
+ def extract(format, carrier)
158
+ @extractors
159
+ .fetch(format)
160
+ .lazy
161
+ .map { |extractor| extractor.extract(carrier) }
162
+ .reject(&:nil?)
163
+ .first
164
+ end
165
+
166
+ private
167
+
168
+ def prepare_span_context(operation_name:, child_of:, references:, ignore_active_scope:)
169
+ context =
170
+ context_from_child_of(child_of) ||
171
+ context_from_references(references) ||
172
+ context_from_active_scope(ignore_active_scope)
173
+
174
+ if context
175
+ [SpanContext.create_from_parent_context(context), {}]
176
+ else
177
+ trace_id = TraceId.generate
178
+ is_sampled, tags = @sampler.sample(
179
+ trace_id: trace_id,
180
+ operation_name: operation_name
181
+ )
182
+ span_context = SpanContext.new(
183
+ trace_id: trace_id,
184
+ span_id: trace_id,
185
+ flags: is_sampled ? SpanContext::Flags::SAMPLED : SpanContext::Flags::NONE
186
+ )
187
+ [span_context, tags]
188
+ end
189
+ end
190
+
191
+ def context_from_child_of(child_of)
192
+ return nil unless child_of
193
+
194
+ child_of.respond_to?(:context) ? child_of.context : child_of
195
+ end
196
+
197
+ def context_from_references(references)
198
+ return nil if !references || references.none?
199
+
200
+ # Prefer CHILD_OF reference if present
201
+ ref = references.detect do |reference|
202
+ reference.type == OpenTracing::Reference::CHILD_OF
203
+ end
204
+ (ref || references[0]).context
205
+ end
206
+
207
+ def context_from_active_scope(ignore_active_scope)
208
+ return if ignore_active_scope
209
+
210
+ active_scope = @scope_manager.active
211
+ active_scope&.span&.context
212
+ end
213
+ end
214
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jaeger
4
+ class UdpSender
5
+ class Transport
6
+ FLAGS = 0
7
+
8
+ def initialize(host, port, logger:)
9
+ @socket = UDPSocket.new
10
+ @host = host
11
+ @port = port
12
+ @logger = logger
13
+ @buffer = ::Thrift::MemoryBufferTransport.new
14
+ end
15
+
16
+ def write(str)
17
+ @buffer.write(str)
18
+ end
19
+
20
+ def flush
21
+ data = @buffer.read(@buffer.available)
22
+ send_bytes(data)
23
+ end
24
+
25
+ def open; end
26
+
27
+ def close; end
28
+
29
+ private
30
+
31
+ def send_bytes(bytes)
32
+ @socket.send(bytes, FLAGS, @host, @port)
33
+ @socket.flush
34
+ rescue Errno::ECONNREFUSED
35
+ @logger.warn 'Unable to connect to Jaeger Agent'
36
+ rescue StandardError => e
37
+ @logger.warn "Unable to send spans: #{e.message}"
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './udp_sender/transport'
4
+ require 'socket'
5
+
6
+ module Jaeger
7
+ class UdpSender
8
+ def initialize(host:, port:, encoder:, logger:, max_packet_size: 65_000)
9
+ @encoder = encoder
10
+ @logger = logger
11
+
12
+ transport = Transport.new(host, port, logger: logger)
13
+ @protocol_class = ::Thrift::CompactProtocol
14
+ protocol = @protocol_class.new(transport)
15
+ @client = Jaeger::Thrift::Agent::Client.new(protocol)
16
+ @max_packet_size = max_packet_size
17
+ end
18
+
19
+ def send_spans(spans)
20
+ batches = @encoder.encode_limited_size(spans, @protocol_class, @max_packet_size)
21
+ batches.each { |batch| @client.emitBatch(batch) }
22
+ rescue StandardError => e
23
+ @logger.error("Failure while sending a batch of spans: #{e}")
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler'
4
+ Bundler.setup
5
+
6
+ require 'jaeger/client'
7
+
8
+ host = ENV['JAEGER_HOST'] || '127.0.0.1'
9
+ port = ENV['JAEGER_HOST'] || 6831
10
+
11
+ tracer1 = Jaeger::Client.build(host: host, port: port.to_i, service_name: 'test-service', flush_interval: 1)
12
+ tracer2 = Jaeger::Client.build(host: host, port: port.to_i, service_name: 'downstream-service', flush_interval: 1)
13
+
14
+ rpc_span = tracer1.start_span(
15
+ 'receive request',
16
+ tags: { 'span.kind' => 'server' }
17
+ )
18
+ sleep 0.1
19
+ rpc_span.log_kv(event: 'woop di doop', count: 5)
20
+ sleep 1
21
+
22
+ async_request_span = tracer1.start_span(
23
+ 'request async action',
24
+ references: [
25
+ OpenTracing::Reference.child_of(rpc_span.context)
26
+ ],
27
+ tags: { 'span.kind' => 'producer' }
28
+ )
29
+ sleep 0.1
30
+
31
+ async_request_span.finish
32
+ rpc_span.finish
33
+
34
+ sleep 0.5
35
+
36
+ async_span = tracer2.start_span(
37
+ 'async span started after rpc span',
38
+ references: [
39
+ OpenTracing::Reference.follows_from(async_request_span.context)
40
+ ],
41
+ tags: {
42
+ 'span.kind' => 'consumer',
43
+ 'peer.service' => 'downstream-service'
44
+ }
45
+ )
46
+ sleep 0.3 # emulate network delay
47
+ async_span.finish
48
+
49
+ sleep 2
50
+
51
+ puts 'Finished'
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler'
4
+ Bundler.setup
5
+
6
+ require 'jaeger/client'
7
+
8
+ host = ENV['JAEGER_HOST'] || '127.0.0.1'
9
+ port = ENV['JAEGER_HOST'] || 6831
10
+
11
+ tracer1 = Jaeger::Client.build(host: host, port: port.to_i, service_name: 'test-service', flush_interval: 1)
12
+ tracer2 = Jaeger::Client.build(host: host, port: port.to_i, service_name: 'downstream-service', flush_interval: 1)
13
+
14
+ outer_span = tracer1.start_span(
15
+ 'receive request',
16
+ tags: { 'span.kind' => 'server' }
17
+ )
18
+ sleep 0.1
19
+ outer_span.log_kv(event: 'woop di doop', count: 5)
20
+ sleep 1
21
+
22
+ inner_span = tracer1.start_span(
23
+ 'fetch info from downstream',
24
+ child_of: outer_span,
25
+ tags: {
26
+ 'span.kind' => 'client',
27
+ 'peer.service' => 'downstream-service',
28
+ 'peer.ipv4' => '6.6.6.6',
29
+ 'peer.port' => 443
30
+ }
31
+ )
32
+ inner_span.set_tag('error', false)
33
+ sleep 0.3 # emulate network delay
34
+
35
+ downstream_span = tracer2.start_span(
36
+ 'downstream operation',
37
+ child_of: inner_span,
38
+ tags: { 'span.kind' => 'server' }
39
+ )
40
+ sleep 0.5
41
+ downstream_span.finish
42
+
43
+ sleep 0.2 # emulate network delay
44
+
45
+ inner_span.finish
46
+
47
+ sleep 0.1 # doing something with fetched info
48
+ outer_span.finish
49
+
50
+ sleep 2
51
+
52
+ puts 'Finished'
@@ -0,0 +1,32 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2016 Uber Technologies, Inc.
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ include "jaeger.thrift"
24
+ include "zipkincore.thrift"
25
+
26
+ namespace java com.uber.jaeger.agent.thrift
27
+ namespace rb Jaeger.Thrift
28
+
29
+ service Agent {
30
+ oneway void emitZipkinBatch(1: list<zipkincore.Span> spans)
31
+ oneway void emitBatch(1: jaeger.Batch batch)
32
+ }
@@ -0,0 +1,118 @@
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/agent/agent_types'
9
+
10
+ module Jaeger
11
+ module Thrift
12
+ module Agent
13
+ module Agent
14
+ class Client
15
+ include ::Thrift::Client
16
+
17
+ def emitZipkinBatch(spans)
18
+ send_emitZipkinBatch(spans)
19
+ end
20
+
21
+ def send_emitZipkinBatch(spans)
22
+ send_oneway_message('emitZipkinBatch', EmitZipkinBatch_args, :spans => spans)
23
+ end
24
+ def emitBatch(batch)
25
+ send_emitBatch(batch)
26
+ end
27
+
28
+ def send_emitBatch(batch)
29
+ send_oneway_message('emitBatch', EmitBatch_args, :batch => batch)
30
+ end
31
+ end
32
+
33
+ class Processor
34
+ include ::Thrift::Processor
35
+
36
+ def process_emitZipkinBatch(seqid, iprot, oprot)
37
+ args = read_args(iprot, EmitZipkinBatch_args)
38
+ @handler.emitZipkinBatch(args.spans)
39
+ return
40
+ end
41
+
42
+ def process_emitBatch(seqid, iprot, oprot)
43
+ args = read_args(iprot, EmitBatch_args)
44
+ @handler.emitBatch(args.batch)
45
+ return
46
+ end
47
+
48
+ end
49
+
50
+ # HELPER FUNCTIONS AND STRUCTURES
51
+
52
+ class EmitZipkinBatch_args
53
+ include ::Thrift::Struct, ::Thrift::Struct_Union
54
+ SPANS = 1
55
+
56
+ FIELDS = {
57
+ SPANS => {:type => ::Thrift::Types::LIST, :name => 'spans', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::Zipkin::Span}}
58
+ }
59
+
60
+ def struct_fields; FIELDS; end
61
+
62
+ def validate
63
+ end
64
+
65
+ ::Thrift::Struct.generate_accessors self
66
+ end
67
+
68
+ class EmitZipkinBatch_result
69
+ include ::Thrift::Struct, ::Thrift::Struct_Union
70
+
71
+ FIELDS = {
72
+
73
+ }
74
+
75
+ def struct_fields; FIELDS; end
76
+
77
+ def validate
78
+ end
79
+
80
+ ::Thrift::Struct.generate_accessors self
81
+ end
82
+
83
+ class EmitBatch_args
84
+ include ::Thrift::Struct, ::Thrift::Struct_Union
85
+ BATCH = 1
86
+
87
+ FIELDS = {
88
+ BATCH => {:type => ::Thrift::Types::STRUCT, :name => 'batch', :class => ::Jaeger::Thrift::Batch}
89
+ }
90
+
91
+ def struct_fields; FIELDS; end
92
+
93
+ def validate
94
+ end
95
+
96
+ ::Thrift::Struct.generate_accessors self
97
+ end
98
+
99
+ class EmitBatch_result
100
+ include ::Thrift::Struct, ::Thrift::Struct_Union
101
+
102
+ FIELDS = {
103
+
104
+ }
105
+
106
+ def struct_fields; FIELDS; end
107
+
108
+ def validate
109
+ end
110
+
111
+ ::Thrift::Struct.generate_accessors self
112
+ end
113
+
114
+ end
115
+
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,15 @@
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/agent/agent_types'
9
+
10
+ module Jaeger
11
+ module Thrift
12
+ module Agent
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
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/jaeger_types'
9
+ require 'jaeger/thrift/zipkin/zipkincore_types'
10
+
11
+
12
+ module Jaeger
13
+ module Thrift
14
+ module Agent
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,116 @@
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/agent_types'
9
+
10
+ module Jaeger
11
+ module Thrift
12
+ module Agent
13
+ class Client
14
+ include ::Thrift::Client
15
+
16
+ def emitZipkinBatch(spans)
17
+ send_emitZipkinBatch(spans)
18
+ end
19
+
20
+ def send_emitZipkinBatch(spans)
21
+ send_oneway_message('emitZipkinBatch', EmitZipkinBatch_args, :spans => spans)
22
+ end
23
+ def emitBatch(batch)
24
+ send_emitBatch(batch)
25
+ end
26
+
27
+ def send_emitBatch(batch)
28
+ send_oneway_message('emitBatch', EmitBatch_args, :batch => batch)
29
+ end
30
+ end
31
+
32
+ class Processor
33
+ include ::Thrift::Processor
34
+
35
+ def process_emitZipkinBatch(seqid, iprot, oprot)
36
+ args = read_args(iprot, EmitZipkinBatch_args)
37
+ @handler.emitZipkinBatch(args.spans)
38
+ return
39
+ end
40
+
41
+ def process_emitBatch(seqid, iprot, oprot)
42
+ args = read_args(iprot, EmitBatch_args)
43
+ @handler.emitBatch(args.batch)
44
+ return
45
+ end
46
+
47
+ end
48
+
49
+ # HELPER FUNCTIONS AND STRUCTURES
50
+
51
+ class EmitZipkinBatch_args
52
+ include ::Thrift::Struct, ::Thrift::Struct_Union
53
+ SPANS = 1
54
+
55
+ FIELDS = {
56
+ SPANS => {:type => ::Thrift::Types::LIST, :name => 'spans', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::Zipkin::Span}}
57
+ }
58
+
59
+ def struct_fields; FIELDS; end
60
+
61
+ def validate
62
+ end
63
+
64
+ ::Thrift::Struct.generate_accessors self
65
+ end
66
+
67
+ class EmitZipkinBatch_result
68
+ include ::Thrift::Struct, ::Thrift::Struct_Union
69
+
70
+ FIELDS = {
71
+
72
+ }
73
+
74
+ def struct_fields; FIELDS; end
75
+
76
+ def validate
77
+ end
78
+
79
+ ::Thrift::Struct.generate_accessors self
80
+ end
81
+
82
+ class EmitBatch_args
83
+ include ::Thrift::Struct, ::Thrift::Struct_Union
84
+ BATCH = 1
85
+
86
+ FIELDS = {
87
+ BATCH => {:type => ::Thrift::Types::STRUCT, :name => 'batch', :class => ::Jaeger::Thrift::Batch}
88
+ }
89
+
90
+ def struct_fields; FIELDS; end
91
+
92
+ def validate
93
+ end
94
+
95
+ ::Thrift::Struct.generate_accessors self
96
+ end
97
+
98
+ class EmitBatch_result
99
+ include ::Thrift::Struct, ::Thrift::Struct_Union
100
+
101
+ FIELDS = {
102
+
103
+ }
104
+
105
+ def struct_fields; FIELDS; end
106
+
107
+ def validate
108
+ end
109
+
110
+ ::Thrift::Struct.generate_accessors self
111
+ end
112
+
113
+ end
114
+
115
+ end
116
+ end
@@ -0,0 +1,13 @@
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/agent_types'
9
+
10
+ module Jaeger
11
+ module Thrift
12
+ end
13
+ end