zipkin-tracer 0.15.1 → 0.16.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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTVjNWU2YmZkZmYxNDhhYzFjMmZmYTFkOWZhOGIwZWNiNjE4NDliNA==
4
+ ZjYzMGY3YjgxYmZjMjdkMjU1Y2MyZDcxOTI2MDBjZjM3Y2ZlMmI5ZA==
5
5
  data.tar.gz: !binary |-
6
- ZDhiYTFhOWZiY2JlNzUwNmU5YTMxYWRkZjY4OWQ4MzdhYzhhMTVhNA==
6
+ NGRmYmRjZTA1MGJlMmE5ZWU3MzE5ZmI3MTFkN2EwNDAxNDVmZWFhNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWRjNjFlMTgyYjk3Zjk5OTg2ZTZhOWM4YzE1ZjdiYTE4MWE2YTg5ZGJkMzU3
10
- NWVjNDJhMGQzOWYzYzBhZjEzYWQ0MjJkZGNhM2E2YTc0Yzk5YjYzYzZlNzYy
11
- MmVhZmI0NTVkODBkYTgzNTRmOGZkZmY5NmVmMDdjYWJkNGZlOTg=
9
+ ZTgxNDgxNjg5NGYwMWM1YWIzNzQ0MDViY2IzMmE5ODRlNjgyMDkyNmJmZWIw
10
+ NjBhNDg5NDA4Njg1NTI1YjU2ODcyZTM4YmZhNTBjMTUwOWZhNDE2NjcyN2Jm
11
+ YzEwMmJkNWQ2NTg3NTdkM2YzZjFhZmE1M2JmY2ZiZjY5OTczNmU=
12
12
  data.tar.gz: !binary |-
13
- NzlhMTg2NjNjMDMxNjgxMWE1ODY1NGU0Y2IwY2E2YTk1NGY2NDZmYTk0NWZl
14
- YzQxNDA5MDRhZmQ0ZTIxYzM3YjE1Mzg4MTQyZDQwYzFhZGNhM2QzM2I1YjE5
15
- YjQ0MDBkNTZlYjM1YTZjYzIxMmRhMDZhZGU5NDM3NWFmY2E4NjA=
13
+ MDRkODlhMGEzYWE0M2M1YmI1OTNkMTg4MDJjOWI5ZWRjNDIwNTY3ZWUwNzc4
14
+ OGE1YmQ3YTBhNTRlMzE4ZmE4YmI2NDNhMzIwNGQ1MzVkMDA1YTdiNDEwODYw
15
+ MzllMTFhYTI3ZGNiYjdmNDhkZmQzMzZlY2VhM2FhNjY1YzUyYmQ=
@@ -5,15 +5,14 @@ module ZipkinTracer
5
5
  # Configuration of this gem. It reads the configuration and provides default values
6
6
  class Config
7
7
  attr_reader :service_name, :service_port, :json_api_host,
8
- :scribe_server, :zookeeper, :sample_rate, :annotate_plugin,
9
- :filter_plugin, :whitelist_plugin, :logger
8
+ :zookeeper, :sample_rate, :logger,
9
+ :annotate_plugin, :filter_plugin, :whitelist_plugin
10
10
 
11
11
  def initialize(app, config_hash)
12
12
  config = config_hash || Application.config(app)
13
13
  @service_name = config[:service_name]
14
14
  @service_port = config[:service_port] || DEFAULTS[:service_port]
15
15
  @json_api_host = config[:json_api_host]
16
- @scribe_server = config[:scribe_server]
17
16
  @zookeeper = config[:zookeeper]
18
17
  @sample_rate = config[:sample_rate] || DEFAULTS[:sample_rate]
19
18
  @annotate_plugin = config[:annotate_plugin] # call for trace annotation
@@ -26,8 +25,6 @@ module ZipkinTracer
26
25
  def adapter
27
26
  if present?(@json_api_host)
28
27
  :json
29
- elsif present?(@scribe_server)
30
- :scribe
31
28
  elsif present?(@zookeeper) && RUBY_PLATFORM == 'java'
32
29
  :kafka
33
30
  elsif @logger_setup
@@ -8,9 +8,6 @@ module ZipkinTracer
8
8
  require 'zipkin-tracer/zipkin_json_tracer'
9
9
  options = { json_api_host: config.json_api_host, logger: config.logger }
10
10
  Trace::ZipkinJsonTracer.new(options)
11
- when :scribe
12
- require 'zipkin-tracer/zipkin_scribe_tracer'
13
- Trace::ScribeTracer.new(scribe_server: config.scribe_server)
14
11
  when :kafka
15
12
  require 'zipkin-tracer/zipkin_kafka_tracer'
16
13
  Trace::ZipkinKafkaTracer.new(zookeepers: config.zookeeper)
@@ -24,7 +21,7 @@ module ZipkinTracer
24
21
  Trace.tracer = tracer
25
22
 
26
23
  # TODO: move this to the TracerBase and kill scribe tracer
27
- ip_format = config.adapter == :json ? :string : :i32
24
+ ip_format = config.adapter == :kafka ? :i32 : :string
28
25
  Trace.default_endpoint = Trace::Endpoint.local_endpoint(
29
26
  config.service_port,
30
27
  service_name(config.service_name),
@@ -12,5 +12,5 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  module ZipkinTracer
15
- VERSION = '0.15.1'.freeze
15
+ VERSION = '0.16.0'.freeze
16
16
  end
@@ -31,7 +31,7 @@ module Trace
31
31
  end
32
32
 
33
33
  def flush!
34
- AsyncJsonApiClient.new.async.perform(@json_api_host, spans.dup)
34
+ AsyncJsonApiClient.perform_async(@json_api_host, spans.dup)
35
35
  end
36
36
  end
37
37
  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.15.1
4
+ version: 0.16.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-02-27 00:00:00.000000000 Z
16
+ date: 2016-02-29 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: faraday
@@ -63,14 +63,14 @@ dependencies:
63
63
  requirements:
64
64
  - - ~>
65
65
  - !ruby/object:Gem::Version
66
- version: '1.6'
66
+ version: '2.0'
67
67
  type: :runtime
68
68
  prerelease: false
69
69
  version_requirements: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - ~>
72
72
  - !ruby/object:Gem::Version
73
- version: '1.6'
73
+ version: '2.0'
74
74
  - !ruby/object:Gem::Dependency
75
75
  name: rspec
76
76
  requirement: !ruby/object:Gem::Requirement
@@ -141,34 +141,6 @@ dependencies:
141
141
  - - ~>
142
142
  - !ruby/object:Gem::Version
143
143
  version: '1.22'
144
- - !ruby/object:Gem::Dependency
145
- name: hermann
146
- requirement: !ruby/object:Gem::Requirement
147
- requirements:
148
- - - ~>
149
- - !ruby/object:Gem::Version
150
- version: '0.25'
151
- type: :development
152
- prerelease: false
153
- version_requirements: !ruby/object:Gem::Requirement
154
- requirements:
155
- - - ~>
156
- - !ruby/object:Gem::Version
157
- version: '0.25'
158
- - !ruby/object:Gem::Dependency
159
- name: scribe
160
- requirement: !ruby/object:Gem::Requirement
161
- requirements:
162
- - - ~>
163
- - !ruby/object:Gem::Version
164
- version: 0.2.4
165
- type: :development
166
- prerelease: false
167
- version_requirements: !ruby/object:Gem::Requirement
168
- requirements:
169
- - - ~>
170
- - !ruby/object:Gem::Version
171
- version: 0.2.4
172
144
  description: Adds tracing instrumentation for ruby applications
173
145
  email:
174
146
  - franklin@twitter.com
@@ -183,7 +155,6 @@ extra_rdoc_files: []
183
155
  files:
184
156
  - lib/zipkin-tracer.rb
185
157
  - lib/zipkin-tracer/application.rb
186
- - lib/zipkin-tracer/careless_scribe.rb
187
158
  - lib/zipkin-tracer/config.rb
188
159
  - lib/zipkin-tracer/faraday/zipkin-tracer.rb
189
160
  - lib/zipkin-tracer/hostname_resolver.rb
@@ -196,7 +167,6 @@ files:
196
167
  - lib/zipkin-tracer/zipkin_kafka_tracer.rb
197
168
  - lib/zipkin-tracer/zipkin_logger_tracer.rb
198
169
  - lib/zipkin-tracer/zipkin_null_tracer.rb
199
- - lib/zipkin-tracer/zipkin_scribe_tracer.rb
200
170
  - lib/zipkin-tracer/zipkin_tracer_base.rb
201
171
  homepage: https://github.com/openzipkin/zipkin-tracer
202
172
  licenses: []
@@ -1,68 +0,0 @@
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
- require 'scribe'
16
- require 'finagle-thrift' #depends on the thift gem
17
- require 'sucker_punch'
18
-
19
- module ScribeThrift
20
- # This is here just for the monkey patching
21
- class Client
22
- # This method in the original class was both sending and receiving logs.
23
- # The original class: https://github.com/twitter/scribe/blob/master/vendor/gen-rb/scribe.rb
24
- # Receiving logs may take even several seconds, depending on the buffering of the collector.
25
- # We are just sending and forgetting here, we do not really care about the result
26
- def Log(messages)
27
- send_Log(messages)
28
- 0 # 0 means success , the original code called recv_Log()
29
- end
30
- end
31
- end
32
-
33
- # SuckerPunch creates a queue and a thread pool to work on jobs on the queue
34
- # calling perform adds the code to the queue
35
- class AsyncScribe
36
- include SuckerPunch::Job
37
-
38
- PROTOCOL_TIMEOUT = 10 # If the timeout is low, the protocol will lose spans when collector is not fast enough
39
- CATEGORY = 'ruby' # Thrift-client already uses this as default, seems to not affect anything
40
- ADD_NEWLINES_TO_MESSAGES = true # True is the default in Thrift-client, seems a necessary internal hack
41
-
42
- def perform(server_address, *args)
43
- # May seem wasteful to open a new connection per each span but the way the scribe is done
44
- # it is difficult to ensure there will be no threading issues unless we create here the connection
45
- scribe = Scribe.new(server_address, CATEGORY, ADD_NEWLINES_TO_MESSAGES, timeout: PROTOCOL_TIMEOUT)
46
- scribe.log(*args)
47
- rescue ThriftClient::NoServersAvailable, Thrift::Exception
48
- # I couldn't care less
49
- end
50
- end
51
-
52
- # Scribe which rescue thrift errors to avoid them to raise to the client
53
- class CarelessScribe
54
- def initialize(scribe_server_address)
55
- @server_address = scribe_server_address
56
- end
57
-
58
- def log(*args)
59
- AsyncScribe.new.async.perform(@server_address, *args)
60
- end
61
-
62
- def batch(&block)
63
- yield #We just yield here
64
- # the block finagle-thrift-1.4.1/lib/finagle-thrift/tracer.rb flush! method will call log also.
65
- rescue ThriftClient::NoServersAvailable, Thrift::Exception
66
- # I couldn't care less
67
- end
68
- end
@@ -1,30 +0,0 @@
1
- require 'zipkin-tracer/zipkin_tracer_base'
2
- require 'zipkin-tracer/careless_scribe'
3
- require 'zipkin-tracer/hostname_resolver'
4
-
5
-
6
- module Trace
7
- class ScribeTracer < ZipkinTracerBase
8
- TRACER_CATEGORY = "zipkin".freeze
9
-
10
- def initialize(options)
11
- @scribe = CarelessScribe.new(options[:scribe_server])
12
- super(options)
13
- end
14
-
15
- def flush!
16
- resolved_spans = ::ZipkinTracer::HostnameResolver.new.spans_with_ips(spans)
17
- @scribe.batch do
18
- messages = resolved_spans.map do |span|
19
- buf = ''
20
- trans = Thrift::MemoryBufferTransport.new(buf)
21
- oprot = Thrift::BinaryProtocol.new(trans)
22
- span.to_thrift.write(oprot)
23
- Base64.encode64(buf).gsub("\n", "")
24
- end
25
- @scribe.log(messages, TRACER_CATEGORY)
26
- end
27
- reset
28
- end
29
- end
30
- end