zipkin-tracer 0.24.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 056a3c8673074ba57da8f43ba8c894bfc64a8c60
|
4
|
+
data.tar.gz: 1c460f925e75c449a4453336a7a3fca17fd04068
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3b25784f7ef65ab5cce860776558e493ae15da118be7c5c9dcc8c271953d986290cd750427eab6595ce19df3c06f21e7fd3aa8b063f3b3a5604090144223b39
|
7
|
+
data.tar.gz: 8a41195765ba46d1a8218a7d75f2f6acc7488470110134a489f628a4f8602cd791ef44d42e7a21afcfc9d7191597d8fb2a478e2f5da6e02fff1a905a34796815
|
data/lib/zipkin-tracer.rb
CHANGED
data/lib/zipkin-tracer/config.rb
CHANGED
@@ -8,7 +8,8 @@ module ZipkinTracer
|
|
8
8
|
attr_reader :service_name, :service_port, :json_api_host,
|
9
9
|
:zookeeper, :sample_rate, :logger, :log_tracing,
|
10
10
|
:annotate_plugin, :filter_plugin, :whitelist_plugin,
|
11
|
-
:sampled_as_boolean, :record_on_server_receive
|
11
|
+
:sampled_as_boolean, :record_on_server_receive,
|
12
|
+
:kafka_producer, :kafka_topic
|
12
13
|
|
13
14
|
def initialize(app, config_hash)
|
14
15
|
config = config_hash || Application.config(app)
|
@@ -20,6 +21,9 @@ module ZipkinTracer
|
|
20
21
|
@json_api_host = config[:json_api_host]
|
21
22
|
# Zookeeper information
|
22
23
|
@zookeeper = config[:zookeeper]
|
24
|
+
# Kafka producer information
|
25
|
+
@kafka_producer = config[:producer]
|
26
|
+
@kafka_topic = config[:topic] if present?(config[:topic])
|
23
27
|
# Percentage of traces which by default this service traces (as float, 1.0 means 100%)
|
24
28
|
@sample_rate = config[:sample_rate] || DEFAULTS[:sample_rate]
|
25
29
|
# A block of code which can be called to do extra annotations of traces
|
@@ -50,6 +54,8 @@ module ZipkinTracer
|
|
50
54
|
:json
|
51
55
|
elsif present?(@zookeeper) && RUBY_PLATFORM == 'java'
|
52
56
|
:kafka
|
57
|
+
elsif @kafka_producer && @kafka_producer.respond_to?(:push)
|
58
|
+
:kafka_producer
|
53
59
|
elsif !!@log_tracing
|
54
60
|
:logger
|
55
61
|
else
|
@@ -11,6 +11,11 @@ module ZipkinTracer
|
|
11
11
|
when :kafka
|
12
12
|
require 'zipkin-tracer/zipkin_kafka_tracer'
|
13
13
|
Trace::ZipkinKafkaTracer.new(zookeepers: config.zookeeper)
|
14
|
+
when :kafka_producer
|
15
|
+
require 'zipkin-tracer/zipkin_kafka_tracer'
|
16
|
+
options = { producer: config.kafka_producer }
|
17
|
+
options[:topic] = config.kafka_topic unless config.kafka_topic.nil?
|
18
|
+
Trace::ZipkinKafkaTracer.new(options)
|
14
19
|
when :logger
|
15
20
|
require 'zipkin-tracer/zipkin_logger_tracer'
|
16
21
|
Trace::ZipkinLoggerTracer.new(logger: config.logger)
|
@@ -21,7 +26,7 @@ module ZipkinTracer
|
|
21
26
|
Trace.tracer = tracer
|
22
27
|
|
23
28
|
# TODO: move this to the TracerBase and kill scribe tracer
|
24
|
-
ip_format = config.adapter
|
29
|
+
ip_format = [:kafka, :kafka_producer].include?(config.adapter) ? :i32 : :string
|
25
30
|
Trace.default_endpoint = Trace::Endpoint.local_endpoint(
|
26
31
|
config.service_port,
|
27
32
|
service_name(config.service_name),
|
@@ -12,7 +12,7 @@ module Trace
|
|
12
12
|
# This class sends information to Zipkin through Kafka.
|
13
13
|
# Spans are encoded using Thrift
|
14
14
|
class ZipkinKafkaTracer < ZipkinTracerBase
|
15
|
-
DEFAULT_KAFKA_TOPIC = "
|
15
|
+
DEFAULT_KAFKA_TOPIC = "zipkin".freeze
|
16
16
|
|
17
17
|
def initialize(options = {})
|
18
18
|
@topic = options[:topic] || DEFAULT_KAFKA_TOPIC
|
@@ -26,6 +26,7 @@ module Trace
|
|
26
26
|
end
|
27
27
|
super(options)
|
28
28
|
end
|
29
|
+
|
29
30
|
def flush!
|
30
31
|
resolved_spans = ::ZipkinTracer::HostnameResolver.new.spans_with_ips(spans)
|
31
32
|
resolved_spans.each do |span|
|
@@ -33,7 +34,6 @@ module Trace
|
|
33
34
|
trans = Thrift::MemoryBufferTransport.new(buf)
|
34
35
|
oprot = Thrift::BinaryProtocol.new(trans)
|
35
36
|
span.to_thrift.write(oprot)
|
36
|
-
|
37
37
|
retval = @producer.push(buf, topic: @topic)
|
38
38
|
|
39
39
|
# If @producer#push returns a promise/promise-like object, block until it
|
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.25.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: 2017-
|
16
|
+
date: 2017-06-29 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: faraday
|