zipkin-query 0.0.1

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,107 @@
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
+
15
+ gen_rb_path = File.expand_path(File.dirname(__FILE__) + "/../vendor/gen-rb")
16
+ $LOAD_PATH.unshift gen_rb_path
17
+ $LOAD_PATH.unshift "#{gen_rb_path}/zipkin-query"
18
+
19
+ require "#{gen_rb_path}/zipkin-query"
20
+
21
+ module ZipkinQuery extend self
22
+
23
+ module Client
24
+ # The node location in zookeeper that stores the cassandra location
25
+ NODE_PATH = "/twitter/service/zipkin/query"
26
+
27
+ def self.with_transport(opts = {})
28
+ # Open a connection to a thrift server, do something, and close the connection
29
+
30
+ begin
31
+
32
+ if opts[:use_local_server]
33
+ # If we're running local (development mode) return a set value
34
+ host = "localhost"
35
+ port = 9149
36
+
37
+ # Create the connection to the local b3 query_daemon which uses different
38
+ # transport mechanism
39
+ socket = Thrift::Socket.new(host, port)
40
+ transport = Thrift::BufferedTransport.new(socket)
41
+ else
42
+ # Get the host and port of the location of the query service from zookeeper
43
+ zk_host = opts[:zk_host] || "localhost"
44
+ zk_port = opts[:zk_port] || 2181
45
+
46
+ host, port = Client::get_query_service(zk_host, zk_port, opts)
47
+
48
+ # Create the connection to the b3 query_daemon
49
+ socket = Thrift::Socket.new(host, port)
50
+ buffered_tp = Thrift::BufferedTransport.new(socket)
51
+ transport = Thrift::FramedTransport.new(buffered_tp)
52
+ end
53
+
54
+ protocol = Thrift::BinaryProtocol.new(transport)
55
+ client = ThriftClient.new(Zipkin::ZipkinQuery::Client, host + ':' + port.to_s, :retries => 0, :timeout => 60)
56
+
57
+ # set up tracing for the client we use to talk to the query daemon
58
+ client_id = FinagleThrift::ClientId.new(:name => "zipkin.prod")
59
+ FinagleThrift.enable_tracing!(client, client_id, "zipkin")
60
+
61
+ begin
62
+ transport.open
63
+ yield(client)
64
+ ensure
65
+ transport.close
66
+ end
67
+ rescue ZookeeperExceptions::ZookeeperException::ConnectionClosed => ze
68
+ "Could not connect to zookeeper at #{opts[:zk_host]}:#{opts[:zk_port]}"
69
+ end
70
+
71
+ end
72
+
73
+ def self.get_query_service(zk_host, zk_port, opts={})
74
+ # Takes either:
75
+ # - ZooKeeper config options that map to a Zipkin Query server set OR
76
+ # - Direct host/port of a Query daemon
77
+
78
+ if opts[:skip_zookeeper]
79
+ return [ opts[:zipkin_query_host], opts[:zipkin_query_port] ]
80
+ end
81
+
82
+ node_path = opts[:node_path] || NODE_PATH
83
+
84
+ # TODO: throw error if it fails
85
+ zk = Zookeeper.new("#{zk_host}:#{zk_port}")
86
+
87
+ begin
88
+ # TODO: handle errors here
89
+ children = zk.get_children(:path => node_path)
90
+ node_key = children[:children][0]
91
+
92
+ # TODO: throw errors
93
+ node = zk.get(:path => "#{node_path}/#{node_key}")
94
+ ensure
95
+ zk.close() if zk
96
+ end
97
+
98
+ # Deserialize the result
99
+ d = Thrift::Deserializer.new
100
+ si = d.deserialize(Twitter::Thrift::ServiceInstance.new, node[:data])
101
+
102
+ # Return the host and port
103
+ [si.serviceEndpoint.host, si.serviceEndpoint.port]
104
+ end
105
+ end
106
+
107
+ end
@@ -0,0 +1,16 @@
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
+ module ZipkinQuery
15
+ VERSION = "0.0.1"
16
+ end
@@ -0,0 +1,19 @@
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
+ require 'set'
15
+ require 'thrift'
16
+
17
+ module ZipkinQuery
18
+ require 'zipkin-query/zipkin_query'
19
+ end
@@ -0,0 +1,18 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.8.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'zipkin_core_types'
8
+
9
+ module Zipkin
10
+ CLIENT_SEND = %q"cs"
11
+
12
+ CLIENT_RECV = %q"cr"
13
+
14
+ SERVER_SEND = %q"ss"
15
+
16
+ SERVER_RECV = %q"sr"
17
+
18
+ end
@@ -0,0 +1,112 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.8.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+
8
+ module Zipkin
9
+ module AnnotationType
10
+ BOOL = 0
11
+ BYTES = 1
12
+ I16 = 2
13
+ I32 = 3
14
+ I64 = 4
15
+ DOUBLE = 5
16
+ STRING = 6
17
+ VALUE_MAP = {0 => "BOOL", 1 => "BYTES", 2 => "I16", 3 => "I32", 4 => "I64", 5 => "DOUBLE", 6 => "STRING"}
18
+ VALID_VALUES = Set.new([BOOL, BYTES, I16, I32, I64, DOUBLE, STRING]).freeze
19
+ end
20
+
21
+ class Endpoint
22
+ include ::Thrift::Struct, ::Thrift::Struct_Union
23
+ IPV4 = 1
24
+ PORT = 2
25
+ SERVICE_NAME = 3
26
+
27
+ FIELDS = {
28
+ IPV4 => {:type => ::Thrift::Types::I32, :name => 'ipv4'},
29
+ PORT => {:type => ::Thrift::Types::I16, :name => 'port'},
30
+ SERVICE_NAME => {:type => ::Thrift::Types::STRING, :name => 'service_name'}
31
+ }
32
+
33
+ def struct_fields; FIELDS; end
34
+
35
+ def validate
36
+ end
37
+
38
+ ::Thrift::Struct.generate_accessors self
39
+ end
40
+
41
+ class Annotation
42
+ include ::Thrift::Struct, ::Thrift::Struct_Union
43
+ TIMESTAMP = 1
44
+ VALUE = 2
45
+ HOST = 3
46
+
47
+ FIELDS = {
48
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'},
49
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'},
50
+ HOST => {:type => ::Thrift::Types::STRUCT, :name => 'host', :class => Zipkin::Endpoint, :optional => true}
51
+ }
52
+
53
+ def struct_fields; FIELDS; end
54
+
55
+ def validate
56
+ end
57
+
58
+ ::Thrift::Struct.generate_accessors self
59
+ end
60
+
61
+ class BinaryAnnotation
62
+ include ::Thrift::Struct, ::Thrift::Struct_Union
63
+ KEY = 1
64
+ VALUE = 2
65
+ ANNOTATION_TYPE = 3
66
+ HOST = 4
67
+
68
+ FIELDS = {
69
+ KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
70
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true},
71
+ ANNOTATION_TYPE => {:type => ::Thrift::Types::I32, :name => 'annotation_type', :enum_class => Zipkin::AnnotationType},
72
+ HOST => {:type => ::Thrift::Types::STRUCT, :name => 'host', :class => Zipkin::Endpoint, :optional => true}
73
+ }
74
+
75
+ def struct_fields; FIELDS; end
76
+
77
+ def validate
78
+ unless @annotation_type.nil? || Zipkin::AnnotationType::VALID_VALUES.include?(@annotation_type)
79
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field annotation_type!')
80
+ end
81
+ end
82
+
83
+ ::Thrift::Struct.generate_accessors self
84
+ end
85
+
86
+ class Span
87
+ include ::Thrift::Struct, ::Thrift::Struct_Union
88
+ TRACE_ID = 1
89
+ NAME = 3
90
+ ID = 4
91
+ PARENT_ID = 5
92
+ ANNOTATIONS = 6
93
+ BINARY_ANNOTATIONS = 8
94
+
95
+ FIELDS = {
96
+ TRACE_ID => {:type => ::Thrift::Types::I64, :name => 'trace_id'},
97
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
98
+ ID => {:type => ::Thrift::Types::I64, :name => 'id'},
99
+ PARENT_ID => {:type => ::Thrift::Types::I64, :name => 'parent_id', :optional => true},
100
+ ANNOTATIONS => {:type => ::Thrift::Types::LIST, :name => 'annotations', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::Annotation}},
101
+ BINARY_ANNOTATIONS => {:type => ::Thrift::Types::LIST, :name => 'binary_annotations', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::BinaryAnnotation}}
102
+ }
103
+
104
+ def struct_fields; FIELDS; end
105
+
106
+ def validate
107
+ end
108
+
109
+ ::Thrift::Struct.generate_accessors self
110
+ end
111
+
112
+ end
@@ -0,0 +1,796 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.8.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'zipkin_query_types'
9
+
10
+ module Zipkin
11
+ module ZipkinQuery
12
+ class Client
13
+ include ::Thrift::Client
14
+
15
+ def getTraceIdsBySpanName(service_name, span_name, end_ts, limit, order)
16
+ send_getTraceIdsBySpanName(service_name, span_name, end_ts, limit, order)
17
+ return recv_getTraceIdsBySpanName()
18
+ end
19
+
20
+ def send_getTraceIdsBySpanName(service_name, span_name, end_ts, limit, order)
21
+ send_message('getTraceIdsBySpanName', GetTraceIdsBySpanName_args, :service_name => service_name, :span_name => span_name, :end_ts => end_ts, :limit => limit, :order => order)
22
+ end
23
+
24
+ def recv_getTraceIdsBySpanName()
25
+ result = receive_message(GetTraceIdsBySpanName_result)
26
+ return result.success unless result.success.nil?
27
+ raise result.qe unless result.qe.nil?
28
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getTraceIdsBySpanName failed: unknown result')
29
+ end
30
+
31
+ def getTraceIdsByServiceName(service_name, end_ts, limit, order)
32
+ send_getTraceIdsByServiceName(service_name, end_ts, limit, order)
33
+ return recv_getTraceIdsByServiceName()
34
+ end
35
+
36
+ def send_getTraceIdsByServiceName(service_name, end_ts, limit, order)
37
+ send_message('getTraceIdsByServiceName', GetTraceIdsByServiceName_args, :service_name => service_name, :end_ts => end_ts, :limit => limit, :order => order)
38
+ end
39
+
40
+ def recv_getTraceIdsByServiceName()
41
+ result = receive_message(GetTraceIdsByServiceName_result)
42
+ return result.success unless result.success.nil?
43
+ raise result.qe unless result.qe.nil?
44
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getTraceIdsByServiceName failed: unknown result')
45
+ end
46
+
47
+ def getTraceIdsByAnnotation(service_name, annotation, value, end_ts, limit, order)
48
+ send_getTraceIdsByAnnotation(service_name, annotation, value, end_ts, limit, order)
49
+ return recv_getTraceIdsByAnnotation()
50
+ end
51
+
52
+ def send_getTraceIdsByAnnotation(service_name, annotation, value, end_ts, limit, order)
53
+ send_message('getTraceIdsByAnnotation', GetTraceIdsByAnnotation_args, :service_name => service_name, :annotation => annotation, :value => value, :end_ts => end_ts, :limit => limit, :order => order)
54
+ end
55
+
56
+ def recv_getTraceIdsByAnnotation()
57
+ result = receive_message(GetTraceIdsByAnnotation_result)
58
+ return result.success unless result.success.nil?
59
+ raise result.qe unless result.qe.nil?
60
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getTraceIdsByAnnotation failed: unknown result')
61
+ end
62
+
63
+ def getTracesByIds(trace_ids, adjust)
64
+ send_getTracesByIds(trace_ids, adjust)
65
+ return recv_getTracesByIds()
66
+ end
67
+
68
+ def send_getTracesByIds(trace_ids, adjust)
69
+ send_message('getTracesByIds', GetTracesByIds_args, :trace_ids => trace_ids, :adjust => adjust)
70
+ end
71
+
72
+ def recv_getTracesByIds()
73
+ result = receive_message(GetTracesByIds_result)
74
+ return result.success unless result.success.nil?
75
+ raise result.qe unless result.qe.nil?
76
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getTracesByIds failed: unknown result')
77
+ end
78
+
79
+ def getTraceTimelinesByIds(trace_ids, adjust)
80
+ send_getTraceTimelinesByIds(trace_ids, adjust)
81
+ return recv_getTraceTimelinesByIds()
82
+ end
83
+
84
+ def send_getTraceTimelinesByIds(trace_ids, adjust)
85
+ send_message('getTraceTimelinesByIds', GetTraceTimelinesByIds_args, :trace_ids => trace_ids, :adjust => adjust)
86
+ end
87
+
88
+ def recv_getTraceTimelinesByIds()
89
+ result = receive_message(GetTraceTimelinesByIds_result)
90
+ return result.success unless result.success.nil?
91
+ raise result.qe unless result.qe.nil?
92
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getTraceTimelinesByIds failed: unknown result')
93
+ end
94
+
95
+ def getTraceSummariesByIds(trace_ids, adjust)
96
+ send_getTraceSummariesByIds(trace_ids, adjust)
97
+ return recv_getTraceSummariesByIds()
98
+ end
99
+
100
+ def send_getTraceSummariesByIds(trace_ids, adjust)
101
+ send_message('getTraceSummariesByIds', GetTraceSummariesByIds_args, :trace_ids => trace_ids, :adjust => adjust)
102
+ end
103
+
104
+ def recv_getTraceSummariesByIds()
105
+ result = receive_message(GetTraceSummariesByIds_result)
106
+ return result.success unless result.success.nil?
107
+ raise result.qe unless result.qe.nil?
108
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getTraceSummariesByIds failed: unknown result')
109
+ end
110
+
111
+ def getTraceCombosByIds(trace_ids, adjust)
112
+ send_getTraceCombosByIds(trace_ids, adjust)
113
+ return recv_getTraceCombosByIds()
114
+ end
115
+
116
+ def send_getTraceCombosByIds(trace_ids, adjust)
117
+ send_message('getTraceCombosByIds', GetTraceCombosByIds_args, :trace_ids => trace_ids, :adjust => adjust)
118
+ end
119
+
120
+ def recv_getTraceCombosByIds()
121
+ result = receive_message(GetTraceCombosByIds_result)
122
+ return result.success unless result.success.nil?
123
+ raise result.qe unless result.qe.nil?
124
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getTraceCombosByIds failed: unknown result')
125
+ end
126
+
127
+ def getServiceNames()
128
+ send_getServiceNames()
129
+ return recv_getServiceNames()
130
+ end
131
+
132
+ def send_getServiceNames()
133
+ send_message('getServiceNames', GetServiceNames_args)
134
+ end
135
+
136
+ def recv_getServiceNames()
137
+ result = receive_message(GetServiceNames_result)
138
+ return result.success unless result.success.nil?
139
+ raise result.qe unless result.qe.nil?
140
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getServiceNames failed: unknown result')
141
+ end
142
+
143
+ def getSpanNames(service_name)
144
+ send_getSpanNames(service_name)
145
+ return recv_getSpanNames()
146
+ end
147
+
148
+ def send_getSpanNames(service_name)
149
+ send_message('getSpanNames', GetSpanNames_args, :service_name => service_name)
150
+ end
151
+
152
+ def recv_getSpanNames()
153
+ result = receive_message(GetSpanNames_result)
154
+ return result.success unless result.success.nil?
155
+ raise result.qe unless result.qe.nil?
156
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getSpanNames failed: unknown result')
157
+ end
158
+
159
+ def setTraceTimeToLive(trace_id, ttl_seconds)
160
+ send_setTraceTimeToLive(trace_id, ttl_seconds)
161
+ recv_setTraceTimeToLive()
162
+ end
163
+
164
+ def send_setTraceTimeToLive(trace_id, ttl_seconds)
165
+ send_message('setTraceTimeToLive', SetTraceTimeToLive_args, :trace_id => trace_id, :ttl_seconds => ttl_seconds)
166
+ end
167
+
168
+ def recv_setTraceTimeToLive()
169
+ result = receive_message(SetTraceTimeToLive_result)
170
+ raise result.qe unless result.qe.nil?
171
+ return
172
+ end
173
+
174
+ def getTraceTimeToLive(trace_id)
175
+ send_getTraceTimeToLive(trace_id)
176
+ return recv_getTraceTimeToLive()
177
+ end
178
+
179
+ def send_getTraceTimeToLive(trace_id)
180
+ send_message('getTraceTimeToLive', GetTraceTimeToLive_args, :trace_id => trace_id)
181
+ end
182
+
183
+ def recv_getTraceTimeToLive()
184
+ result = receive_message(GetTraceTimeToLive_result)
185
+ return result.success unless result.success.nil?
186
+ raise result.qe unless result.qe.nil?
187
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getTraceTimeToLive failed: unknown result')
188
+ end
189
+
190
+ def getDataTimeToLive()
191
+ send_getDataTimeToLive()
192
+ return recv_getDataTimeToLive()
193
+ end
194
+
195
+ def send_getDataTimeToLive()
196
+ send_message('getDataTimeToLive', GetDataTimeToLive_args)
197
+ end
198
+
199
+ def recv_getDataTimeToLive()
200
+ result = receive_message(GetDataTimeToLive_result)
201
+ return result.success unless result.success.nil?
202
+ raise result.qe unless result.qe.nil?
203
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getDataTimeToLive failed: unknown result')
204
+ end
205
+
206
+ end
207
+
208
+ class Processor
209
+ include ::Thrift::Processor
210
+
211
+ def process_getTraceIdsBySpanName(seqid, iprot, oprot)
212
+ args = read_args(iprot, GetTraceIdsBySpanName_args)
213
+ result = GetTraceIdsBySpanName_result.new()
214
+ begin
215
+ result.success = @handler.getTraceIdsBySpanName(args.service_name, args.span_name, args.end_ts, args.limit, args.order)
216
+ rescue Zipkin::QueryException => qe
217
+ result.qe = qe
218
+ end
219
+ write_result(result, oprot, 'getTraceIdsBySpanName', seqid)
220
+ end
221
+
222
+ def process_getTraceIdsByServiceName(seqid, iprot, oprot)
223
+ args = read_args(iprot, GetTraceIdsByServiceName_args)
224
+ result = GetTraceIdsByServiceName_result.new()
225
+ begin
226
+ result.success = @handler.getTraceIdsByServiceName(args.service_name, args.end_ts, args.limit, args.order)
227
+ rescue Zipkin::QueryException => qe
228
+ result.qe = qe
229
+ end
230
+ write_result(result, oprot, 'getTraceIdsByServiceName', seqid)
231
+ end
232
+
233
+ def process_getTraceIdsByAnnotation(seqid, iprot, oprot)
234
+ args = read_args(iprot, GetTraceIdsByAnnotation_args)
235
+ result = GetTraceIdsByAnnotation_result.new()
236
+ begin
237
+ result.success = @handler.getTraceIdsByAnnotation(args.service_name, args.annotation, args.value, args.end_ts, args.limit, args.order)
238
+ rescue Zipkin::QueryException => qe
239
+ result.qe = qe
240
+ end
241
+ write_result(result, oprot, 'getTraceIdsByAnnotation', seqid)
242
+ end
243
+
244
+ def process_getTracesByIds(seqid, iprot, oprot)
245
+ args = read_args(iprot, GetTracesByIds_args)
246
+ result = GetTracesByIds_result.new()
247
+ begin
248
+ result.success = @handler.getTracesByIds(args.trace_ids, args.adjust)
249
+ rescue Zipkin::QueryException => qe
250
+ result.qe = qe
251
+ end
252
+ write_result(result, oprot, 'getTracesByIds', seqid)
253
+ end
254
+
255
+ def process_getTraceTimelinesByIds(seqid, iprot, oprot)
256
+ args = read_args(iprot, GetTraceTimelinesByIds_args)
257
+ result = GetTraceTimelinesByIds_result.new()
258
+ begin
259
+ result.success = @handler.getTraceTimelinesByIds(args.trace_ids, args.adjust)
260
+ rescue Zipkin::QueryException => qe
261
+ result.qe = qe
262
+ end
263
+ write_result(result, oprot, 'getTraceTimelinesByIds', seqid)
264
+ end
265
+
266
+ def process_getTraceSummariesByIds(seqid, iprot, oprot)
267
+ args = read_args(iprot, GetTraceSummariesByIds_args)
268
+ result = GetTraceSummariesByIds_result.new()
269
+ begin
270
+ result.success = @handler.getTraceSummariesByIds(args.trace_ids, args.adjust)
271
+ rescue Zipkin::QueryException => qe
272
+ result.qe = qe
273
+ end
274
+ write_result(result, oprot, 'getTraceSummariesByIds', seqid)
275
+ end
276
+
277
+ def process_getTraceCombosByIds(seqid, iprot, oprot)
278
+ args = read_args(iprot, GetTraceCombosByIds_args)
279
+ result = GetTraceCombosByIds_result.new()
280
+ begin
281
+ result.success = @handler.getTraceCombosByIds(args.trace_ids, args.adjust)
282
+ rescue Zipkin::QueryException => qe
283
+ result.qe = qe
284
+ end
285
+ write_result(result, oprot, 'getTraceCombosByIds', seqid)
286
+ end
287
+
288
+ def process_getServiceNames(seqid, iprot, oprot)
289
+ args = read_args(iprot, GetServiceNames_args)
290
+ result = GetServiceNames_result.new()
291
+ begin
292
+ result.success = @handler.getServiceNames()
293
+ rescue Zipkin::QueryException => qe
294
+ result.qe = qe
295
+ end
296
+ write_result(result, oprot, 'getServiceNames', seqid)
297
+ end
298
+
299
+ def process_getSpanNames(seqid, iprot, oprot)
300
+ args = read_args(iprot, GetSpanNames_args)
301
+ result = GetSpanNames_result.new()
302
+ begin
303
+ result.success = @handler.getSpanNames(args.service_name)
304
+ rescue Zipkin::QueryException => qe
305
+ result.qe = qe
306
+ end
307
+ write_result(result, oprot, 'getSpanNames', seqid)
308
+ end
309
+
310
+ def process_setTraceTimeToLive(seqid, iprot, oprot)
311
+ args = read_args(iprot, SetTraceTimeToLive_args)
312
+ result = SetTraceTimeToLive_result.new()
313
+ begin
314
+ @handler.setTraceTimeToLive(args.trace_id, args.ttl_seconds)
315
+ rescue Zipkin::QueryException => qe
316
+ result.qe = qe
317
+ end
318
+ write_result(result, oprot, 'setTraceTimeToLive', seqid)
319
+ end
320
+
321
+ def process_getTraceTimeToLive(seqid, iprot, oprot)
322
+ args = read_args(iprot, GetTraceTimeToLive_args)
323
+ result = GetTraceTimeToLive_result.new()
324
+ begin
325
+ result.success = @handler.getTraceTimeToLive(args.trace_id)
326
+ rescue Zipkin::QueryException => qe
327
+ result.qe = qe
328
+ end
329
+ write_result(result, oprot, 'getTraceTimeToLive', seqid)
330
+ end
331
+
332
+ def process_getDataTimeToLive(seqid, iprot, oprot)
333
+ args = read_args(iprot, GetDataTimeToLive_args)
334
+ result = GetDataTimeToLive_result.new()
335
+ begin
336
+ result.success = @handler.getDataTimeToLive()
337
+ rescue Zipkin::QueryException => qe
338
+ result.qe = qe
339
+ end
340
+ write_result(result, oprot, 'getDataTimeToLive', seqid)
341
+ end
342
+
343
+ end
344
+
345
+ # HELPER FUNCTIONS AND STRUCTURES
346
+
347
+ class GetTraceIdsBySpanName_args
348
+ include ::Thrift::Struct, ::Thrift::Struct_Union
349
+ SERVICE_NAME = 1
350
+ SPAN_NAME = 2
351
+ END_TS = 4
352
+ LIMIT = 5
353
+ ORDER = 6
354
+
355
+ FIELDS = {
356
+ SERVICE_NAME => {:type => ::Thrift::Types::STRING, :name => 'service_name'},
357
+ SPAN_NAME => {:type => ::Thrift::Types::STRING, :name => 'span_name'},
358
+ END_TS => {:type => ::Thrift::Types::I64, :name => 'end_ts'},
359
+ LIMIT => {:type => ::Thrift::Types::I32, :name => 'limit'},
360
+ ORDER => {:type => ::Thrift::Types::I32, :name => 'order', :enum_class => Zipkin::Order}
361
+ }
362
+
363
+ def struct_fields; FIELDS; end
364
+
365
+ def validate
366
+ unless @order.nil? || Zipkin::Order::VALID_VALUES.include?(@order)
367
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field order!')
368
+ end
369
+ end
370
+
371
+ ::Thrift::Struct.generate_accessors self
372
+ end
373
+
374
+ class GetTraceIdsBySpanName_result
375
+ include ::Thrift::Struct, ::Thrift::Struct_Union
376
+ SUCCESS = 0
377
+ QE = 1
378
+
379
+ FIELDS = {
380
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::I64}},
381
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
382
+ }
383
+
384
+ def struct_fields; FIELDS; end
385
+
386
+ def validate
387
+ end
388
+
389
+ ::Thrift::Struct.generate_accessors self
390
+ end
391
+
392
+ class GetTraceIdsByServiceName_args
393
+ include ::Thrift::Struct, ::Thrift::Struct_Union
394
+ SERVICE_NAME = 1
395
+ END_TS = 3
396
+ LIMIT = 4
397
+ ORDER = 5
398
+
399
+ FIELDS = {
400
+ SERVICE_NAME => {:type => ::Thrift::Types::STRING, :name => 'service_name'},
401
+ END_TS => {:type => ::Thrift::Types::I64, :name => 'end_ts'},
402
+ LIMIT => {:type => ::Thrift::Types::I32, :name => 'limit'},
403
+ ORDER => {:type => ::Thrift::Types::I32, :name => 'order', :enum_class => Zipkin::Order}
404
+ }
405
+
406
+ def struct_fields; FIELDS; end
407
+
408
+ def validate
409
+ unless @order.nil? || Zipkin::Order::VALID_VALUES.include?(@order)
410
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field order!')
411
+ end
412
+ end
413
+
414
+ ::Thrift::Struct.generate_accessors self
415
+ end
416
+
417
+ class GetTraceIdsByServiceName_result
418
+ include ::Thrift::Struct, ::Thrift::Struct_Union
419
+ SUCCESS = 0
420
+ QE = 1
421
+
422
+ FIELDS = {
423
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::I64}},
424
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
425
+ }
426
+
427
+ def struct_fields; FIELDS; end
428
+
429
+ def validate
430
+ end
431
+
432
+ ::Thrift::Struct.generate_accessors self
433
+ end
434
+
435
+ class GetTraceIdsByAnnotation_args
436
+ include ::Thrift::Struct, ::Thrift::Struct_Union
437
+ SERVICE_NAME = 1
438
+ ANNOTATION = 2
439
+ VALUE = 3
440
+ END_TS = 5
441
+ LIMIT = 6
442
+ ORDER = 7
443
+
444
+ FIELDS = {
445
+ SERVICE_NAME => {:type => ::Thrift::Types::STRING, :name => 'service_name'},
446
+ ANNOTATION => {:type => ::Thrift::Types::STRING, :name => 'annotation'},
447
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true},
448
+ END_TS => {:type => ::Thrift::Types::I64, :name => 'end_ts'},
449
+ LIMIT => {:type => ::Thrift::Types::I32, :name => 'limit'},
450
+ ORDER => {:type => ::Thrift::Types::I32, :name => 'order', :enum_class => Zipkin::Order}
451
+ }
452
+
453
+ def struct_fields; FIELDS; end
454
+
455
+ def validate
456
+ unless @order.nil? || Zipkin::Order::VALID_VALUES.include?(@order)
457
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field order!')
458
+ end
459
+ end
460
+
461
+ ::Thrift::Struct.generate_accessors self
462
+ end
463
+
464
+ class GetTraceIdsByAnnotation_result
465
+ include ::Thrift::Struct, ::Thrift::Struct_Union
466
+ SUCCESS = 0
467
+ QE = 1
468
+
469
+ FIELDS = {
470
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::I64}},
471
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
472
+ }
473
+
474
+ def struct_fields; FIELDS; end
475
+
476
+ def validate
477
+ end
478
+
479
+ ::Thrift::Struct.generate_accessors self
480
+ end
481
+
482
+ class GetTracesByIds_args
483
+ include ::Thrift::Struct, ::Thrift::Struct_Union
484
+ TRACE_IDS = 1
485
+ ADJUST = 2
486
+
487
+ FIELDS = {
488
+ TRACE_IDS => {:type => ::Thrift::Types::LIST, :name => 'trace_ids', :element => {:type => ::Thrift::Types::I64}},
489
+ ADJUST => {:type => ::Thrift::Types::LIST, :name => 'adjust', :element => {:type => ::Thrift::Types::I32, :enum_class => Zipkin::Adjust}}
490
+ }
491
+
492
+ def struct_fields; FIELDS; end
493
+
494
+ def validate
495
+ end
496
+
497
+ ::Thrift::Struct.generate_accessors self
498
+ end
499
+
500
+ class GetTracesByIds_result
501
+ include ::Thrift::Struct, ::Thrift::Struct_Union
502
+ SUCCESS = 0
503
+ QE = 1
504
+
505
+ FIELDS = {
506
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::Trace}},
507
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
508
+ }
509
+
510
+ def struct_fields; FIELDS; end
511
+
512
+ def validate
513
+ end
514
+
515
+ ::Thrift::Struct.generate_accessors self
516
+ end
517
+
518
+ class GetTraceTimelinesByIds_args
519
+ include ::Thrift::Struct, ::Thrift::Struct_Union
520
+ TRACE_IDS = 1
521
+ ADJUST = 2
522
+
523
+ FIELDS = {
524
+ TRACE_IDS => {:type => ::Thrift::Types::LIST, :name => 'trace_ids', :element => {:type => ::Thrift::Types::I64}},
525
+ ADJUST => {:type => ::Thrift::Types::LIST, :name => 'adjust', :element => {:type => ::Thrift::Types::I32, :enum_class => Zipkin::Adjust}}
526
+ }
527
+
528
+ def struct_fields; FIELDS; end
529
+
530
+ def validate
531
+ end
532
+
533
+ ::Thrift::Struct.generate_accessors self
534
+ end
535
+
536
+ class GetTraceTimelinesByIds_result
537
+ include ::Thrift::Struct, ::Thrift::Struct_Union
538
+ SUCCESS = 0
539
+ QE = 1
540
+
541
+ FIELDS = {
542
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::TraceTimeline}},
543
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
544
+ }
545
+
546
+ def struct_fields; FIELDS; end
547
+
548
+ def validate
549
+ end
550
+
551
+ ::Thrift::Struct.generate_accessors self
552
+ end
553
+
554
+ class GetTraceSummariesByIds_args
555
+ include ::Thrift::Struct, ::Thrift::Struct_Union
556
+ TRACE_IDS = 1
557
+ ADJUST = 2
558
+
559
+ FIELDS = {
560
+ TRACE_IDS => {:type => ::Thrift::Types::LIST, :name => 'trace_ids', :element => {:type => ::Thrift::Types::I64}},
561
+ ADJUST => {:type => ::Thrift::Types::LIST, :name => 'adjust', :element => {:type => ::Thrift::Types::I32, :enum_class => Zipkin::Adjust}}
562
+ }
563
+
564
+ def struct_fields; FIELDS; end
565
+
566
+ def validate
567
+ end
568
+
569
+ ::Thrift::Struct.generate_accessors self
570
+ end
571
+
572
+ class GetTraceSummariesByIds_result
573
+ include ::Thrift::Struct, ::Thrift::Struct_Union
574
+ SUCCESS = 0
575
+ QE = 1
576
+
577
+ FIELDS = {
578
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::TraceSummary}},
579
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
580
+ }
581
+
582
+ def struct_fields; FIELDS; end
583
+
584
+ def validate
585
+ end
586
+
587
+ ::Thrift::Struct.generate_accessors self
588
+ end
589
+
590
+ class GetTraceCombosByIds_args
591
+ include ::Thrift::Struct, ::Thrift::Struct_Union
592
+ TRACE_IDS = 1
593
+ ADJUST = 2
594
+
595
+ FIELDS = {
596
+ TRACE_IDS => {:type => ::Thrift::Types::LIST, :name => 'trace_ids', :element => {:type => ::Thrift::Types::I64}},
597
+ ADJUST => {:type => ::Thrift::Types::LIST, :name => 'adjust', :element => {:type => ::Thrift::Types::I32, :enum_class => Zipkin::Adjust}}
598
+ }
599
+
600
+ def struct_fields; FIELDS; end
601
+
602
+ def validate
603
+ end
604
+
605
+ ::Thrift::Struct.generate_accessors self
606
+ end
607
+
608
+ class GetTraceCombosByIds_result
609
+ include ::Thrift::Struct, ::Thrift::Struct_Union
610
+ SUCCESS = 0
611
+ QE = 1
612
+
613
+ FIELDS = {
614
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::TraceCombo}},
615
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
616
+ }
617
+
618
+ def struct_fields; FIELDS; end
619
+
620
+ def validate
621
+ end
622
+
623
+ ::Thrift::Struct.generate_accessors self
624
+ end
625
+
626
+ class GetServiceNames_args
627
+ include ::Thrift::Struct, ::Thrift::Struct_Union
628
+
629
+ FIELDS = {
630
+
631
+ }
632
+
633
+ def struct_fields; FIELDS; end
634
+
635
+ def validate
636
+ end
637
+
638
+ ::Thrift::Struct.generate_accessors self
639
+ end
640
+
641
+ class GetServiceNames_result
642
+ include ::Thrift::Struct, ::Thrift::Struct_Union
643
+ SUCCESS = 0
644
+ QE = 1
645
+
646
+ FIELDS = {
647
+ SUCCESS => {:type => ::Thrift::Types::SET, :name => 'success', :element => {:type => ::Thrift::Types::STRING}},
648
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
649
+ }
650
+
651
+ def struct_fields; FIELDS; end
652
+
653
+ def validate
654
+ end
655
+
656
+ ::Thrift::Struct.generate_accessors self
657
+ end
658
+
659
+ class GetSpanNames_args
660
+ include ::Thrift::Struct, ::Thrift::Struct_Union
661
+ SERVICE_NAME = 1
662
+
663
+ FIELDS = {
664
+ SERVICE_NAME => {:type => ::Thrift::Types::STRING, :name => 'service_name'}
665
+ }
666
+
667
+ def struct_fields; FIELDS; end
668
+
669
+ def validate
670
+ end
671
+
672
+ ::Thrift::Struct.generate_accessors self
673
+ end
674
+
675
+ class GetSpanNames_result
676
+ include ::Thrift::Struct, ::Thrift::Struct_Union
677
+ SUCCESS = 0
678
+ QE = 1
679
+
680
+ FIELDS = {
681
+ SUCCESS => {:type => ::Thrift::Types::SET, :name => 'success', :element => {:type => ::Thrift::Types::STRING}},
682
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
683
+ }
684
+
685
+ def struct_fields; FIELDS; end
686
+
687
+ def validate
688
+ end
689
+
690
+ ::Thrift::Struct.generate_accessors self
691
+ end
692
+
693
+ class SetTraceTimeToLive_args
694
+ include ::Thrift::Struct, ::Thrift::Struct_Union
695
+ TRACE_ID = 1
696
+ TTL_SECONDS = 2
697
+
698
+ FIELDS = {
699
+ TRACE_ID => {:type => ::Thrift::Types::I64, :name => 'trace_id'},
700
+ TTL_SECONDS => {:type => ::Thrift::Types::I32, :name => 'ttl_seconds'}
701
+ }
702
+
703
+ def struct_fields; FIELDS; end
704
+
705
+ def validate
706
+ end
707
+
708
+ ::Thrift::Struct.generate_accessors self
709
+ end
710
+
711
+ class SetTraceTimeToLive_result
712
+ include ::Thrift::Struct, ::Thrift::Struct_Union
713
+ QE = 1
714
+
715
+ FIELDS = {
716
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
717
+ }
718
+
719
+ def struct_fields; FIELDS; end
720
+
721
+ def validate
722
+ end
723
+
724
+ ::Thrift::Struct.generate_accessors self
725
+ end
726
+
727
+ class GetTraceTimeToLive_args
728
+ include ::Thrift::Struct, ::Thrift::Struct_Union
729
+ TRACE_ID = 1
730
+
731
+ FIELDS = {
732
+ TRACE_ID => {:type => ::Thrift::Types::I64, :name => 'trace_id'}
733
+ }
734
+
735
+ def struct_fields; FIELDS; end
736
+
737
+ def validate
738
+ end
739
+
740
+ ::Thrift::Struct.generate_accessors self
741
+ end
742
+
743
+ class GetTraceTimeToLive_result
744
+ include ::Thrift::Struct, ::Thrift::Struct_Union
745
+ SUCCESS = 0
746
+ QE = 1
747
+
748
+ FIELDS = {
749
+ SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'},
750
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
751
+ }
752
+
753
+ def struct_fields; FIELDS; end
754
+
755
+ def validate
756
+ end
757
+
758
+ ::Thrift::Struct.generate_accessors self
759
+ end
760
+
761
+ class GetDataTimeToLive_args
762
+ include ::Thrift::Struct, ::Thrift::Struct_Union
763
+
764
+ FIELDS = {
765
+
766
+ }
767
+
768
+ def struct_fields; FIELDS; end
769
+
770
+ def validate
771
+ end
772
+
773
+ ::Thrift::Struct.generate_accessors self
774
+ end
775
+
776
+ class GetDataTimeToLive_result
777
+ include ::Thrift::Struct, ::Thrift::Struct_Union
778
+ SUCCESS = 0
779
+ QE = 1
780
+
781
+ FIELDS = {
782
+ SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'},
783
+ QE => {:type => ::Thrift::Types::STRUCT, :name => 'qe', :class => Zipkin::QueryException}
784
+ }
785
+
786
+ def struct_fields; FIELDS; end
787
+
788
+ def validate
789
+ end
790
+
791
+ ::Thrift::Struct.generate_accessors self
792
+ end
793
+
794
+ end
795
+
796
+ end
@@ -0,0 +1,10 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.8.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'zipkin_query_types'
8
+
9
+ module Zipkin
10
+ end
@@ -0,0 +1,169 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.8.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'zipkin_core_types'
8
+
9
+
10
+ module Zipkin
11
+ module Order
12
+ TIMESTAMP_DESC = 0
13
+ TIMESTAMP_ASC = 1
14
+ DURATION_ASC = 2
15
+ DURATION_DESC = 3
16
+ NONE = 4
17
+ VALUE_MAP = {0 => "TIMESTAMP_DESC", 1 => "TIMESTAMP_ASC", 2 => "DURATION_ASC", 3 => "DURATION_DESC", 4 => "NONE"}
18
+ VALID_VALUES = Set.new([TIMESTAMP_DESC, TIMESTAMP_ASC, DURATION_ASC, DURATION_DESC, NONE]).freeze
19
+ end
20
+
21
+ module Adjust
22
+ NOTHING = 0
23
+ TIME_SKEW = 1
24
+ VALUE_MAP = {0 => "NOTHING", 1 => "TIME_SKEW"}
25
+ VALID_VALUES = Set.new([NOTHING, TIME_SKEW]).freeze
26
+ end
27
+
28
+ class Trace
29
+ include ::Thrift::Struct, ::Thrift::Struct_Union
30
+ SPANS = 1
31
+
32
+ FIELDS = {
33
+ SPANS => {:type => ::Thrift::Types::LIST, :name => 'spans', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::Span}}
34
+ }
35
+
36
+ def struct_fields; FIELDS; end
37
+
38
+ def validate
39
+ end
40
+
41
+ ::Thrift::Struct.generate_accessors self
42
+ end
43
+
44
+ class QueryException < ::Thrift::Exception
45
+ include ::Thrift::Struct, ::Thrift::Struct_Union
46
+ def initialize(message=nil)
47
+ super()
48
+ self.msg = message
49
+ end
50
+
51
+ def message; msg end
52
+
53
+ MSG = 1
54
+
55
+ FIELDS = {
56
+ MSG => {:type => ::Thrift::Types::STRING, :name => 'msg'}
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
+ # This sums up a single Trace to make it easy for a client to get an overview of what happened.
68
+ class TraceSummary
69
+ include ::Thrift::Struct, ::Thrift::Struct_Union
70
+ TRACE_ID = 1
71
+ START_TIMESTAMP = 2
72
+ END_TIMESTAMP = 3
73
+ DURATION_MICRO = 4
74
+ SERVICE_COUNTS = 5
75
+ ENDPOINTS = 6
76
+
77
+ FIELDS = {
78
+ TRACE_ID => {:type => ::Thrift::Types::I64, :name => 'trace_id'},
79
+ START_TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'start_timestamp'},
80
+ END_TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'end_timestamp'},
81
+ DURATION_MICRO => {:type => ::Thrift::Types::I32, :name => 'duration_micro'},
82
+ SERVICE_COUNTS => {:type => ::Thrift::Types::MAP, :name => 'service_counts', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I32}},
83
+ ENDPOINTS => {:type => ::Thrift::Types::LIST, :name => 'endpoints', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::Endpoint}}
84
+ }
85
+
86
+ def struct_fields; FIELDS; end
87
+
88
+ def validate
89
+ end
90
+
91
+ ::Thrift::Struct.generate_accessors self
92
+ end
93
+
94
+ # A modified version of the Annotation struct that brings in more information
95
+ class TimelineAnnotation
96
+ include ::Thrift::Struct, ::Thrift::Struct_Union
97
+ TIMESTAMP = 1
98
+ VALUE = 2
99
+ HOST = 3
100
+ SPAN_ID = 4
101
+ PARENT_ID = 5
102
+ SERVICE_NAME = 6
103
+ SPAN_NAME = 7
104
+
105
+ FIELDS = {
106
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'},
107
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'},
108
+ HOST => {:type => ::Thrift::Types::STRUCT, :name => 'host', :class => Zipkin::Endpoint},
109
+ SPAN_ID => {:type => ::Thrift::Types::I64, :name => 'span_id'},
110
+ PARENT_ID => {:type => ::Thrift::Types::I64, :name => 'parent_id', :optional => true},
111
+ SERVICE_NAME => {:type => ::Thrift::Types::STRING, :name => 'service_name'},
112
+ SPAN_NAME => {:type => ::Thrift::Types::STRING, :name => 'span_name'}
113
+ }
114
+
115
+ def struct_fields; FIELDS; end
116
+
117
+ def validate
118
+ end
119
+
120
+ ::Thrift::Struct.generate_accessors self
121
+ end
122
+
123
+ # This sums up a single Trace to make it easy for a client to get an overview of what happened.
124
+ class TraceTimeline
125
+ include ::Thrift::Struct, ::Thrift::Struct_Union
126
+ TRACE_ID = 1
127
+ ROOT_MOST_SPAN_ID = 2
128
+ ANNOTATIONS = 6
129
+ BINARY_ANNOTATIONS = 7
130
+
131
+ FIELDS = {
132
+ TRACE_ID => {:type => ::Thrift::Types::I64, :name => 'trace_id'},
133
+ ROOT_MOST_SPAN_ID => {:type => ::Thrift::Types::I64, :name => 'root_most_span_id'},
134
+ ANNOTATIONS => {:type => ::Thrift::Types::LIST, :name => 'annotations', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::TimelineAnnotation}},
135
+ BINARY_ANNOTATIONS => {:type => ::Thrift::Types::LIST, :name => 'binary_annotations', :element => {:type => ::Thrift::Types::STRUCT, :class => Zipkin::BinaryAnnotation}}
136
+ }
137
+
138
+ def struct_fields; FIELDS; end
139
+
140
+ def validate
141
+ end
142
+
143
+ ::Thrift::Struct.generate_accessors self
144
+ end
145
+
146
+ # Returns a combination of trace, summary and timeline.
147
+ class TraceCombo
148
+ include ::Thrift::Struct, ::Thrift::Struct_Union
149
+ TRACE = 1
150
+ SUMMARY = 2
151
+ TIMELINE = 3
152
+ SPAN_DEPTHS = 4
153
+
154
+ FIELDS = {
155
+ TRACE => {:type => ::Thrift::Types::STRUCT, :name => 'trace', :class => Zipkin::Trace},
156
+ SUMMARY => {:type => ::Thrift::Types::STRUCT, :name => 'summary', :class => Zipkin::TraceSummary, :optional => true},
157
+ TIMELINE => {:type => ::Thrift::Types::STRUCT, :name => 'timeline', :class => Zipkin::TraceTimeline, :optional => true},
158
+ SPAN_DEPTHS => {:type => ::Thrift::Types::MAP, :name => 'span_depths', :key => {:type => ::Thrift::Types::I64}, :value => {:type => ::Thrift::Types::I32}, :optional => true}
159
+ }
160
+
161
+ def struct_fields; FIELDS; end
162
+
163
+ def validate
164
+ end
165
+
166
+ ::Thrift::Struct.generate_accessors self
167
+ end
168
+
169
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zipkin-query
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Franklin Hu
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-06-12 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: thrift
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - "="
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 0
31
+ - 6
32
+ - 0
33
+ version: 0.6.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: Client for accessing the Zipkin query service
37
+ email:
38
+ - franklin@twitter.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - lib/zipkin-query/version.rb
47
+ - lib/zipkin-query.rb
48
+ - vendor/gen-rb/zipkin-query/zipkin_core_constants.rb
49
+ - vendor/gen-rb/zipkin-query/zipkin_core_types.rb
50
+ - vendor/gen-rb/zipkin-query/zipkin_query.rb
51
+ - vendor/gen-rb/zipkin-query/zipkin_query_constants.rb
52
+ - vendor/gen-rb/zipkin-query/zipkin_query_types.rb
53
+ - vendor/gen-rb/zipkin-query.rb
54
+ homepage: https://github.com/twitter/zipkin
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 17
77
+ segments:
78
+ - 1
79
+ - 3
80
+ - 5
81
+ version: 1.3.5
82
+ requirements: []
83
+
84
+ rubyforge_project:
85
+ rubygems_version: 1.8.15
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Zipkin Query client
89
+ test_files: []
90
+