zipkin-tracer 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/zipkin-tracer/version.rb +1 -1
- data/lib/zipkin-tracer/zipkin_kafka_tracer.rb +29 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGI3MWNlMzU2NDUzNzdiYjg3MmEyNzFiZjIyZGQ0NmE2NzQzNjg3ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjZlZDcxMGYyNTY4NDdhMWQxZWNlMDg4YzY2YTI5Y2I5M2UyNTNkOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2NiZjRiYTA3MmUwMTViZGFkNDZiYWFkNzRkY2U1ZmNlYjhjOTE4ZTkwYjY1
|
10
|
+
YzAzYjVlOGM5OGQyMWY0ZDAwYzFiN2QzNDA5MWFkMDdjMWU5Y2VlZTdjMGY3
|
11
|
+
YmVkNjVmYmNiNDkzZmYzM2ViYjdiNjUyOTUzMzM2MTA2MDVhYTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWRkY2VhZjNmZTM5MjY1YjJiN2FhMjM3N2I1MTQ0MDhlNzhjZmEzNDYxMzhm
|
14
|
+
ODYzN2JlN2YyMWRlNDVmMTgwMTlmYmU4NTQwYTJlNTRkNzBhNDUyODRlZDQ4
|
15
|
+
NzBlYjJiM2MxN2E3MjM1Yzg5ZTEzMTY2ZmYzNjg2YWY3MjlkM2Q=
|
@@ -1,5 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# IF hermann isn't present, we might be providing another kafka producer
|
2
|
+
begin
|
3
|
+
require 'hermann/producer'
|
4
|
+
require 'hermann/discovery/zookeeper'
|
5
|
+
rescue LoadError => e
|
6
|
+
end
|
7
|
+
|
3
8
|
require 'zipkin-tracer/zipkin_tracer_base'
|
4
9
|
require 'zipkin-tracer/hostname_resolver'
|
5
10
|
|
@@ -11,11 +16,16 @@ module Trace
|
|
11
16
|
|
12
17
|
def initialize(options = {})
|
13
18
|
@topic = options[:topic] || DEFAULT_KAFKA_TOPIC
|
14
|
-
|
15
|
-
|
19
|
+
|
20
|
+
if options[:producer] && options[:producer].respond_to?(:push)
|
21
|
+
@producer = options[:producer]
|
22
|
+
elsif options[:zookeepers]
|
23
|
+
initialize_hermann_producer(options[:zookeepers])
|
24
|
+
else
|
25
|
+
raise ArgumentError, "No (kafka) :producer option (accepting #push) and no :zookeeper option provided."
|
26
|
+
end
|
16
27
|
super(options)
|
17
28
|
end
|
18
|
-
|
19
29
|
def flush!
|
20
30
|
resolved_spans = ::ZipkinTracer::HostnameResolver.new.spans_with_ips(spans)
|
21
31
|
resolved_spans.each do |span|
|
@@ -23,10 +33,23 @@ module Trace
|
|
23
33
|
trans = Thrift::MemoryBufferTransport.new(buf)
|
24
34
|
oprot = Thrift::BinaryProtocol.new(trans)
|
25
35
|
span.to_thrift.write(oprot)
|
26
|
-
|
36
|
+
|
37
|
+
retval = @producer.push(buf, topic: @topic)
|
38
|
+
|
39
|
+
# If @producer#push returns a promise/promise-like object, block until it
|
40
|
+
# resolves
|
41
|
+
retval.value! if retval.respond_to?(:value!)
|
42
|
+
|
43
|
+
retval
|
27
44
|
end
|
28
45
|
rescue Exception
|
29
46
|
# Ignore socket errors, etc
|
30
47
|
end
|
48
|
+
|
49
|
+
private
|
50
|
+
def initialize_hermann_producer(zookeepers)
|
51
|
+
broker_ids = Hermann::Discovery::Zookeeper.new(zookeepers).get_brokers
|
52
|
+
@producer = Hermann::Producer.new(nil, broker_ids)
|
53
|
+
end
|
31
54
|
end
|
32
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zipkin-tracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franklin Hu
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2016-
|
16
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: faraday
|