signalfx-tracing 1.4.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +5 -5
- data/bin/sfx-rb-trace-bootstrap +2 -2
- data/gem.deps.rb +1 -1
- data/lib/signalfx/tracing.rb +4 -1
- data/lib/signalfx/tracing/client.rb +38 -0
- data/lib/signalfx/tracing/instrumentation/faraday.rb +2 -2
- data/lib/signalfx/tracing/span.rb +21 -0
- data/lib/signalfx/tracing/tracer.rb +9 -1
- data/lib/signalfx/tracing/version.rb +1 -1
- data/signalfx-tracing.gemspec +2 -1
- metadata +21 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e746c7d7bd14f60dd0f45b263b38e05e4f4e591b221ad877d047c38aaf4ec8bf
|
4
|
+
data.tar.gz: 7916da5154ead8d2cd37325bfa1bf9ed4f254704919d9802fb883a5783a0aeb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e82266212716e99449a73c3d11a8bbee4229c213b95d3be3cea1e96e562ea97969f807f95ebfec0c5e12fae2155ad9b7b8a6960eee7a6a7675e51979d8554f9
|
7
|
+
data.tar.gz: 26cd1d84fb7171603390a5f569122d7a91919e5c53b44041a358d651c685ae428d538e81afc6af780bec5024320dae394b0e8d2790e8ea4523077fdc8d8089c0
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Here are the requirements and supported software for the library.
|
|
34
34
|
| [Mysql2](#mysql2) | mysql2-instrumentation | >= 0.4.0 |
|
35
35
|
| [Net::HTTP](#nethttp) | nethttp-instrumentation | Ruby >= 2.0 |
|
36
36
|
| [Pg](#pg) | pg-instrumentation | >= 0.18.0 |
|
37
|
-
| [Rack](#rack) | rack-tracer
|
37
|
+
| [Rack](#rack) | sfx-rack-tracer | >= 0.10.0 |
|
38
38
|
| [Rails](#rails) | rails-instrumentation | >= 3.0.0 |
|
39
39
|
| [Redis](#redis) | redis-instrumentation | >= 4.0.0 |
|
40
40
|
| [RestClient](#restclient) | restclient-instrumentation | >= 1.5.0 |
|
@@ -44,7 +44,7 @@ Here are the requirements and supported software for the library.
|
|
44
44
|
|
45
45
|
Instrumentation for routes using Puma or Passenger is provided through
|
46
46
|
Rack. If you use a framework that builds on top of Rack, such as Rails or
|
47
|
-
Sinatra, install the `rack-tracer` instrumentation with your dependency manager
|
47
|
+
Sinatra, install the `sfx-rack-tracer` instrumentation with your dependency manager
|
48
48
|
or with the bootstrap utility. In these cases, the routes through the web
|
49
49
|
server are automatically traced.
|
50
50
|
|
@@ -369,7 +369,7 @@ end
|
|
369
369
|
```
|
370
370
|
### Rack
|
371
371
|
|
372
|
-
Rack spans are created using the `rack-tracer` gem. This is enabled
|
372
|
+
Rack spans are created using the `sfx-rack-tracer` gem. This is enabled
|
373
373
|
automatically for other frameworks that are built on top of Rack, but it can
|
374
374
|
also be separately enabled.
|
375
375
|
|
@@ -394,7 +394,7 @@ use Rack::Tracer
|
|
394
394
|
### Rails
|
395
395
|
|
396
396
|
Rails applications can be traced using the notifications provided by ActiveSupport.
|
397
|
-
It will use `rack-tracer` to trace by requests.
|
397
|
+
It will use `sfx-rack-tracer` to trace by requests.
|
398
398
|
|
399
399
|
The forked source for this instrumentation is located
|
400
400
|
[here](https://github.com/signalfx/ruby-rails-instrumentation).
|
@@ -541,7 +541,7 @@ Arguments:
|
|
541
541
|
### Sinatra
|
542
542
|
|
543
543
|
Sinatra instrumentation traces requests and template rendering. The instrumenter
|
544
|
-
registers a Sinatra extension that uses `rack-tracer` to trace requests and
|
544
|
+
registers a Sinatra extension that uses `sfx-rack-tracer` to trace requests and
|
545
545
|
monkey-patches to trace view rendering. Rack instrumentation is automatically
|
546
546
|
enabled when using Sinatra instrumentation.
|
547
547
|
|
data/bin/sfx-rb-trace-bootstrap
CHANGED
@@ -12,8 +12,8 @@ instrumentations = {
|
|
12
12
|
"mysql2" => ["mysql2-instrumentation", "~> 0.2.1"],
|
13
13
|
"nethttp" => ["nethttp-instrumentation", "~> 0.1.2"],
|
14
14
|
"pg" => ["pg-instrumentation", "~> 0.1.0"],
|
15
|
-
"rack" => ["rack-tracer",
|
16
|
-
"rails" => ["rails-instrumentation", "~> 0.1.
|
15
|
+
"rack" => ["sfx-rack-tracer", "~> 0.10.0"],
|
16
|
+
"rails" => ["rails-instrumentation", "~> 0.1.5"],
|
17
17
|
"redis" => ["redis-instrumentation", "~> 0.2.0"],
|
18
18
|
"restclient" => ["restclient-instrumentation", "~> 0.1.1"],
|
19
19
|
"sequel" => ["sequel-instrumentation", "~> 0.1.0"],
|
data/gem.deps.rb
CHANGED
@@ -5,7 +5,7 @@ group :instrumentations do
|
|
5
5
|
gem 'mysql2-instrumentation', '~> 0.2.1'
|
6
6
|
gem 'nethttp-instrumentation', '~> 0.1.2'
|
7
7
|
gem 'pg-instrumentation', '~> 0.1.0'
|
8
|
-
gem 'rack-tracer',
|
8
|
+
gem 'sfx-rack-tracer', '0.10.0'
|
9
9
|
gem 'rails-instrumentation', '0.1.3'
|
10
10
|
gem 'redis-instrumentation', '~> 0.2.0'
|
11
11
|
gem 'restclient-instrumentation', '~> 0.1.1'
|
data/lib/signalfx/tracing.rb
CHANGED
@@ -2,8 +2,11 @@ require 'jaeger/client'
|
|
2
2
|
require 'signalfx/tracing/http_sender'
|
3
3
|
require 'signalfx/tracing/register'
|
4
4
|
require 'signalfx/tracing/compat'
|
5
|
+
require 'signalfx/tracing/client'
|
5
6
|
require 'signalfx/tracing/sfx_logger'
|
6
7
|
require 'signalfx/tracing/tags'
|
8
|
+
require 'signalfx/tracing/tracer'
|
9
|
+
require 'signalfx/tracing/span'
|
7
10
|
require 'thread'
|
8
11
|
|
9
12
|
module SignalFx
|
@@ -75,7 +78,7 @@ module SignalFx
|
|
75
78
|
OpenTracing::FORMAT_TEXT_MAP => [Jaeger::Client::Extractors::B3TextMapCodec]
|
76
79
|
}
|
77
80
|
|
78
|
-
@tracer =
|
81
|
+
@tracer = SignalFx::Tracing::Client.build(
|
79
82
|
service_name: service_name,
|
80
83
|
reporter: @reporter,
|
81
84
|
injectors: injectors,
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module SignalFx
|
2
|
+
module Tracing
|
3
|
+
module Client
|
4
|
+
include ::Jaeger::Client
|
5
|
+
|
6
|
+
def self.build(host: '127.0.0.1',
|
7
|
+
port: 6831,
|
8
|
+
service_name:,
|
9
|
+
flush_interval: DEFAULT_FLUSH_INTERVAL,
|
10
|
+
sampler: Samplers::Const.new(true),
|
11
|
+
logger: Logger.new(STDOUT),
|
12
|
+
sender: nil,
|
13
|
+
reporter: nil,
|
14
|
+
injectors: {},
|
15
|
+
extractors: {},
|
16
|
+
tags: {})
|
17
|
+
encoder = Encoders::ThriftEncoder.new(service_name: service_name, tags: tags)
|
18
|
+
|
19
|
+
if sender
|
20
|
+
warn '[DEPRECATION] Passing `sender` directly to Jaeger::Client.build is deprecated.' \
|
21
|
+
'Please use `reporter` instead.'
|
22
|
+
end
|
23
|
+
|
24
|
+
reporter ||= Reporters::RemoteReporter.new(
|
25
|
+
sender: sender || UdpSender.new(host: host, port: port, encoder: encoder, logger: logger),
|
26
|
+
flush_interval: flush_interval
|
27
|
+
)
|
28
|
+
|
29
|
+
Tracer.new(
|
30
|
+
reporter: reporter,
|
31
|
+
sampler: sampler,
|
32
|
+
injectors: Injectors.prepare(injectors),
|
33
|
+
extractors: Extractors.prepare(extractors)
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -31,9 +31,9 @@ module SignalFx
|
|
31
31
|
::Faraday::Connection.module_eval do
|
32
32
|
alias_method :initialize_original, :initialize
|
33
33
|
|
34
|
-
def initialize(url = nil, options = nil)
|
34
|
+
def initialize(url = nil, options = nil, &block)
|
35
35
|
# initialize the connection as usual
|
36
|
-
initialize_original(url, options)
|
36
|
+
initialize_original(url, options, &block)
|
37
37
|
|
38
38
|
# before we let go, add the Faraday tracer to the beginning of the stack
|
39
39
|
@builder.insert(0, ::Faraday::Tracer)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'jaeger/span'
|
2
|
+
|
3
|
+
module SignalFx
|
4
|
+
module Tracing
|
5
|
+
module Span
|
6
|
+
def set_error(error)
|
7
|
+
set_tag('error', true)
|
8
|
+
log_kv(
|
9
|
+
event: 'error',
|
10
|
+
:'error.kind' => error.class.to_s,
|
11
|
+
:'error.object' => error,
|
12
|
+
message: error.message,
|
13
|
+
stack: error.backtrace.join("\n")
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
Jaeger::Span.class_eval { include SignalFx::Tracing::Span }
|
@@ -1,14 +1,22 @@
|
|
1
|
+
require 'jaeger/tracer'
|
1
2
|
|
2
3
|
# The default jaeger tracer doesn't expose @reporter, and attr_accessor can't
|
3
4
|
# be added after the fact in a child class. So this just adds an old-fashioned
|
4
5
|
# setter for @reporter.
|
6
|
+
# This also adds the set_error method that can be used to add an exception to
|
7
|
+
# the currently active span.
|
5
8
|
|
6
9
|
module SignalFx
|
7
10
|
module Tracing
|
8
|
-
class Tracer < ::Jaeger::
|
11
|
+
class Tracer < ::Jaeger::Tracer
|
9
12
|
def set_reporter(reporter)
|
10
13
|
@reporter = reporter
|
11
14
|
end
|
15
|
+
|
16
|
+
def set_error(error)
|
17
|
+
span = active_span
|
18
|
+
span.set_error(error) if span
|
19
|
+
end
|
12
20
|
end
|
13
21
|
end
|
14
22
|
end
|
data/signalfx-tracing.gemspec
CHANGED
@@ -20,8 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "test-unit"
|
25
26
|
|
26
27
|
# TODO pin versions once consistent across all dependencies
|
27
28
|
spec.add_dependency "opentracing", "> 0.3.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: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SignalFx, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: test-unit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: opentracing
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,6 +110,7 @@ files:
|
|
96
110
|
- bin/sfx-rb-trace-bootstrap
|
97
111
|
- gem.deps.rb
|
98
112
|
- lib/signalfx/tracing.rb
|
113
|
+
- lib/signalfx/tracing/client.rb
|
99
114
|
- lib/signalfx/tracing/compat.rb
|
100
115
|
- lib/signalfx/tracing/compat/phusion_passenger.rb
|
101
116
|
- lib/signalfx/tracing/http_sender.rb
|
@@ -118,6 +133,7 @@ files:
|
|
118
133
|
- lib/signalfx/tracing/register.rb
|
119
134
|
- lib/signalfx/tracing/reporter/auto_reviving_async_reporter.rb
|
120
135
|
- lib/signalfx/tracing/sfx_logger.rb
|
136
|
+
- lib/signalfx/tracing/span.rb
|
121
137
|
- lib/signalfx/tracing/tags.rb
|
122
138
|
- lib/signalfx/tracing/tracer.rb
|
123
139
|
- lib/signalfx/tracing/version.rb
|
@@ -141,8 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
157
|
- !ruby/object:Gem::Version
|
142
158
|
version: '0'
|
143
159
|
requirements: []
|
144
|
-
|
145
|
-
rubygems_version: 2.7.6.2
|
160
|
+
rubygems_version: 3.1.2
|
146
161
|
signing_key:
|
147
162
|
specification_version: 4
|
148
163
|
summary: Auto-instrumentation framework for Ruby
|