jaeger-client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/jaeger-client.gemspec +28 -0
- data/lib/jaeger/client.rb +19 -0
- data/lib/jaeger/client/carrier.rb +27 -0
- data/lib/jaeger/client/span.rb +74 -0
- data/lib/jaeger/client/span_context.rb +29 -0
- data/lib/jaeger/client/trace_id.rb +11 -0
- data/lib/jaeger/client/tracer.rb +85 -0
- data/lib/jaeger/client/udp_sender.rb +130 -0
- data/script/create_trace +43 -0
- data/thrift/agent.thrift +32 -0
- data/thrift/gen-rb/jaeger/thrift/agent.rb +116 -0
- data/thrift/gen-rb/jaeger/thrift/agent/agent.rb +118 -0
- data/thrift/gen-rb/jaeger/thrift/agent/agent_constants.rb +15 -0
- data/thrift/gen-rb/jaeger/thrift/agent/agent_types.rb +17 -0
- data/thrift/gen-rb/jaeger/thrift/agent_constants.rb +13 -0
- data/thrift/gen-rb/jaeger/thrift/agent_types.rb +15 -0
- data/thrift/gen-rb/jaeger/thrift/collector.rb +82 -0
- data/thrift/gen-rb/jaeger/thrift/jaeger_constants.rb +13 -0
- data/thrift/gen-rb/jaeger/thrift/jaeger_types.rb +211 -0
- data/thrift/gen-rb/jaeger/thrift/zipkin/zipkin_collector.rb +84 -0
- data/thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_constants.rb +41 -0
- data/thrift/gen-rb/jaeger/thrift/zipkin/zipkincore_types.rb +220 -0
- data/thrift/jaeger.thrift +88 -0
- data/thrift/zipkincore.thrift +300 -0
- metadata +147 -0
data/script/create_trace
ADDED
@@ -0,0 +1,43 @@
|
|
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')
|
12
|
+
tracer2 = Jaeger::Client.build(host: host, port: port.to_i, service_name: 'downstream-service')
|
13
|
+
|
14
|
+
outer_span = tracer1.start_span('receive request', tags: {
|
15
|
+
'span.kind' => 'server'
|
16
|
+
})
|
17
|
+
sleep 0.1
|
18
|
+
outer_span.log(event: 'woop di doop', count: 5)
|
19
|
+
sleep 1
|
20
|
+
|
21
|
+
inner_span = tracer1.start_span('fetch info from downstream', child_of: outer_span, tags: {
|
22
|
+
'span.kind' => 'client',
|
23
|
+
'peer.service' => 'downstream-service',
|
24
|
+
'peer.ipv4' => '6.6.6.6',
|
25
|
+
'peer.port' => 443
|
26
|
+
})
|
27
|
+
sleep 0.3 # emulate network delay
|
28
|
+
|
29
|
+
downstream_span = tracer2.start_span('downstream operation', child_of: inner_span, tags: {
|
30
|
+
'span.kind' => 'server'
|
31
|
+
})
|
32
|
+
sleep 0.5
|
33
|
+
downstream_span.finish
|
34
|
+
|
35
|
+
sleep 0.2 # emulate network delay
|
36
|
+
|
37
|
+
inner_span.finish
|
38
|
+
|
39
|
+
sleep 0.1 # doing something with fetched info
|
40
|
+
outer_span.finish
|
41
|
+
|
42
|
+
puts "Finishing..."
|
43
|
+
sleep 3
|
data/thrift/agent.thrift
ADDED
@@ -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,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,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,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/jaeger_types'
|
9
|
+
require 'jaeger/thrift/zipkin/zipkincore_types'
|
10
|
+
|
11
|
+
|
12
|
+
module Jaeger
|
13
|
+
module Thrift
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,82 @@
|
|
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
|
+
|
10
|
+
module Jaeger
|
11
|
+
module Thrift
|
12
|
+
module Collector
|
13
|
+
class Client
|
14
|
+
include ::Thrift::Client
|
15
|
+
|
16
|
+
def submitBatches(batches)
|
17
|
+
send_submitBatches(batches)
|
18
|
+
return recv_submitBatches()
|
19
|
+
end
|
20
|
+
|
21
|
+
def send_submitBatches(batches)
|
22
|
+
send_message('submitBatches', SubmitBatches_args, :batches => batches)
|
23
|
+
end
|
24
|
+
|
25
|
+
def recv_submitBatches()
|
26
|
+
result = receive_message(SubmitBatches_result)
|
27
|
+
return result.success unless result.success.nil?
|
28
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'submitBatches failed: unknown result')
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
class Processor
|
34
|
+
include ::Thrift::Processor
|
35
|
+
|
36
|
+
def process_submitBatches(seqid, iprot, oprot)
|
37
|
+
args = read_args(iprot, SubmitBatches_args)
|
38
|
+
result = SubmitBatches_result.new()
|
39
|
+
result.success = @handler.submitBatches(args.batches)
|
40
|
+
write_result(result, oprot, 'submitBatches', seqid)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
46
|
+
|
47
|
+
class SubmitBatches_args
|
48
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
49
|
+
BATCHES = 1
|
50
|
+
|
51
|
+
FIELDS = {
|
52
|
+
BATCHES => {:type => ::Thrift::Types::LIST, :name => 'batches', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::Batch}}
|
53
|
+
}
|
54
|
+
|
55
|
+
def struct_fields; FIELDS; end
|
56
|
+
|
57
|
+
def validate
|
58
|
+
end
|
59
|
+
|
60
|
+
::Thrift::Struct.generate_accessors self
|
61
|
+
end
|
62
|
+
|
63
|
+
class SubmitBatches_result
|
64
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
65
|
+
SUCCESS = 0
|
66
|
+
|
67
|
+
FIELDS = {
|
68
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::BatchSubmitResponse}}
|
69
|
+
}
|
70
|
+
|
71
|
+
def struct_fields; FIELDS; end
|
72
|
+
|
73
|
+
def validate
|
74
|
+
end
|
75
|
+
|
76
|
+
::Thrift::Struct.generate_accessors self
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|