signalfx-tracing 0.1.0 → 0.1.1

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: a420459939e98542547b4e5e7e6c767b004cb711
4
- data.tar.gz: f688a0ec1e90979c4abdd6b3384d75f6d4146bb5
3
+ metadata.gz: 1c6ff836a9a573045e3aac0ea378a834f286b98f
4
+ data.tar.gz: 6f195c1c6bfc7bb9ae83b7c554af22b2451e7532
5
5
  SHA512:
6
- metadata.gz: 191c96d35b8e2ff7eb6b77f734be4a1ebf30a7f6f3daf0e95f7e4e87f3499f56498d63e13e27093c2cb88b4a7e769e9df62709e1f63012329ae53add06ae9dcb
7
- data.tar.gz: bcff8a6b2a0b9742b104299dfe22e331c32a3f5b38bf68912e6df0239f4277e6264d164cf4331fee241d12284c8c01a3755257b84d4093a5ae853472fd82c393
6
+ metadata.gz: e7c2c8fe68cc903d5a3d378d30810fcb14ed1eed352261d80081f07c1534609cdf789698cfff2b78b5fd34699aaaaa8c2ea18681a85915a3dc44083a4153fba6
7
+ data.tar.gz: 6e3fa6cdbbf10bc991a7b3b7039536c6af3681806e5ae6172c9afa2b0359515e58f7deb4c45930f9b6188df6b0224486d2aca18537ca3ea6445e9f12eb07c57f
data/README.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Ruby auto-instrumenter
2
2
 
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'signalfx-tracing'
9
+ ```
10
+
11
+ and then execute:
12
+
13
+ ```bash
14
+ $ bundle install
15
+ ```
16
+
3
17
  ## Usage
4
18
 
5
19
  Configure the instrumentation anywhere in the setup portion of your code or before doing anything
@@ -75,8 +89,8 @@ This section contains details and configuration for specific frameworks.
75
89
  | Mongo | >= 2.1 |
76
90
  | Mysql2 | >= 0.5.0 |
77
91
  | Net::HTTP | Ruby > 2.0 |
78
- | Rack | |
79
- | Rails | |
92
+ | Rack | >= 2.0 |
93
+ | Rails | >= 4.2.0 |
80
94
  | REST Client | >= 2.0.0 |
81
95
  | Sinatra | >= 1.1.4 |
82
96
 
@@ -151,7 +165,7 @@ conn = Faraday.new(url: 'http://localhost:3000/') do |faraday|
151
165
  end
152
166
  ```
153
167
 
154
- For more detailed usage, please check the instrumenation's page.
168
+ For more detailed usage, please check the instrumentation's page.
155
169
 
156
170
  ## Mysql2
157
171
 
@@ -232,10 +246,16 @@ The source for this instrumentation is located [here](https://github.com/signalf
232
246
 
233
247
  ```ruby
234
248
  SignalFx::Tracing::Instrumenter.configure do |p|
235
- p.instrument(:RestClient)
249
+ p.instrument(:RestClient, tracer: tracer, propagate: true)
236
250
  end
237
251
  ```
238
252
 
253
+ Arguments:
254
+ - `tracer`: Optional custom tracer to use for this instrumentation
255
+ - Default: `OpenTracing.global_tracer`
256
+ - `propagate`: Propagate spans to the request endpoint.
257
+ - Default: `false`
258
+
239
259
  ## Sinatra
240
260
 
241
261
  Sinatra instrumentation traces requests and template rendering. The instrumenter
@@ -8,10 +8,11 @@ module SignalFx
8
8
  class << self
9
9
 
10
10
  def instrument(opts = {})
11
- require 'net/http/tracer'
11
+ require 'net/http/instrumentation'
12
12
 
13
+ tracer = opts.fetch(:tracer, OpenTracing.global_tracer)
13
14
  ignore_request = lambda { Thread.current.thread_variable_get(:http_sender_thread) }
14
- ::Net::Http::Tracer.instrument(ignore_request: ignore_request)
15
+ ::Net::Http::Instrumentation.instrument(tracer: tracer, ignore_request: ignore_request)
15
16
  end
16
17
  end
17
18
  end
@@ -16,7 +16,9 @@ module SignalFx
16
16
 
17
17
  require 'restclient/instrumentation'
18
18
 
19
- ::RestClient::Instrumentation.instrument
19
+ tracer = opts.fetch(:tracer, OpenTracing.global_tracer)
20
+ propagate = opts.fetch(:propagate, false)
21
+ ::RestClient::Instrumentation.instrument(tracer: tracer, propagate: propagate)
20
22
  end
21
23
  end
22
24
  end
@@ -14,7 +14,7 @@ module SignalFx
14
14
  return
15
15
  end
16
16
 
17
- require 'sinatra/tracer'
17
+ require 'sinatra/instrumentation'
18
18
  end
19
19
  end
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module Signalfx
2
2
  module Tracing
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -1,4 +1,6 @@
1
1
  require 'jaeger/client'
2
+ require 'jaeger/client/injectors'
3
+ require 'jaeger/client/extractors'
2
4
  require 'signalfx/tracing/http_sender'
3
5
  require 'signalfx/tracing/register'
4
6
  require 'thread'
@@ -48,7 +50,18 @@ module SignalFx
48
50
 
49
51
  http_sender = SignalFx::Tracing::HttpSenderWithFlag.new(url: @ingest_url, headers: headers, encoder: encoder)
50
52
 
51
- @tracer = Jaeger::Client.build(service_name: service_name, sender: http_sender, flush_interval: 1)
53
+ injectors = {
54
+ OpenTracing::FORMAT_RACK => [Jaeger::Client::Injectors::B3RackCodec]
55
+ }
56
+ extractors = {
57
+ OpenTracing::FORMAT_RACK => [Jaeger::Client::Extractors::B3RackCodec]
58
+ }
59
+
60
+ @tracer = Jaeger::Client.build(service_name: service_name,
61
+ sender: http_sender,
62
+ injectors: injectors,
63
+ extractors: extractors,
64
+ flush_interval: 1)
52
65
  OpenTracing.global_tracer = @tracer
53
66
  else
54
67
  @tracer = tracer
@@ -56,5 +69,8 @@ module SignalFx
56
69
  end
57
70
  end
58
71
  end
72
+
73
+ # auto-configure if the correct env var is set
74
+ Instrumenter.configure(auto_instrument: true) if ENV['SIGNALFX_AUTO_INSTRUMENT'] == 'true'
59
75
  end
60
76
  end
@@ -36,7 +36,8 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  # TODO pin versions once consistent across all dependencies
38
38
  spec.add_dependency "opentracing", "> 0.3.0"
39
- spec.add_dependency "jaeger-client", "~> 0.6.1"
39
+ # spec.add_dependency "jaeger-client", "~> 0.6.1"
40
+ spec.add_dependency "jaeger-client", "~> 0.7.0"
40
41
 
41
42
  spec.add_dependency "sinatra-instrumentation", "~> 0.1"
42
43
  spec.add_dependency "nethttp-instrumentation", "~> 0.1"
@@ -45,8 +46,8 @@ Gem::Specification.new do |spec|
45
46
  spec.add_dependency "mysql2-instrumentation", "~> 0.1"
46
47
 
47
48
  # forks
48
- spec.add_dependency "signalfx-rails-instrumentation", "~> 0.1.0"
49
- spec.add_dependency "signalfx-elasticsearch-instrumentation", "~> 0.1.0"
49
+ spec.add_dependency "signalfx-rails-instrumentation", "~> 0.1"
50
+ spec.add_dependency "signalfx-elasticsearch-instrumentation", "~> 0.1"
50
51
 
51
52
  # external
52
53
  spec.add_dependency "faraday-tracer", "~> 0.7.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signalfx-tracing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashwin Chandrasekar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-14 00:00:00.000000000 Z
11
+ date: 2018-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.6.1
61
+ version: 0.7.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.6.1
68
+ version: 0.7.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sinatra-instrumentation
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -142,28 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.1.0
145
+ version: '0.1'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.1.0
152
+ version: '0.1'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: signalfx-elasticsearch-instrumentation
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.1.0
159
+ version: '0.1'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.1.0
166
+ version: '0.1'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: faraday-tracer
169
169
  requirement: !ruby/object:Gem::Requirement