signalfx-tracing 1.4.1 → 1.5.2

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
  SHA256:
3
- metadata.gz: a97734502b6a3086f287a0b3190e87f955ef504ed7d84e9d52c8daae57775498
4
- data.tar.gz: 0c2afab9431d500c0c00ead0c4ce39ab65218816d3c87169a111b8b313664685
3
+ metadata.gz: 76f49e90a746e01bab86b3172c2ddd7f49aae975d70191f297a1e18e110e558d
4
+ data.tar.gz: 677c15658a0d10c61c8defc270e1c9a4d84c8e838626dfc9fc63198927ba755f
5
5
  SHA512:
6
- metadata.gz: 71ef7d2302c154ac3ec32527875864b58c79896e4f78213aeeb12806a2c806b75287980a8143d1f2d5ee3d345af1f1ab8c7892fffba5a596cff423434dfd6b21
7
- data.tar.gz: e4f1620cb3c8e2389a2baad58b615fdd5e7a16b8098e8060a69473a1d4d429f546c2edbd073b3ef1157e5201257cd0a4ef157a4964a54ce5e0d0d9a48dca4501
6
+ metadata.gz: b934a8cdc290183f72306b772e1b4422171ad3c717fe97c9f9c697deb543c67d95ce25b7c7073dcc50e30a888a1ae5101477fb6260c611c82c985ee81d11b7bb
7
+ data.tar.gz: 91a4a8d6817d3c28cb70672f315706a5c4153d279a956682650c0adf4d7ec69fa6ab305c38dce31220eca11932a924e6d63484427c18288057218cb13b69fa77
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ /vendor/
1
2
  *.lock
2
3
  *.gem
3
4
  .idea
data/README.md CHANGED
@@ -29,12 +29,12 @@ Here are the requirements and supported software for the library.
29
29
  | [ActiveRecord](#active-record) | activerecord-opentracing | ~> 5.0 |
30
30
  | [Elasticsearch](#elasticsearch) | signalfx-elasticsearch-instrumentation | >= 6.0.2 |
31
31
  | [Faraday](#faraday) | signalfx-faraday-instrumentation | >= 0.9.0 |
32
- | [Grape](#grape) | grape-instrumentation | >= 0.13.0 |
32
+ | [Grape](#grape) | grape-instrumentation | >= 0.2.0 |
33
33
  | [Mongo](#mongo) | mongodb-instrumentation | >= 2.1.0 |
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 | >= 0.1 |
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,12 +369,12 @@ 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
 
376
376
  The source for this instrumentation is located
377
- [here](https://github.com/opentracing-contrib/ruby-rack-tracer).
377
+ [here](https://github.com/signalfx/ruby-rack-tracer).
378
378
 
379
379
  #### Usage
380
380
 
@@ -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
 
@@ -7,13 +7,13 @@ instrumentations = {
7
7
  "activerecord" => ["activerecord-opentracing", "~> 0.2.1"],
8
8
  "elasticsearch" => ["signalfx-elasticsearch-instrumentation", "~> 0.1.0"],
9
9
  "faraday" => ["signalfx-faraday-instrumentation", "~> 0.1.1"],
10
- "grape" => ["grape-instrumentation", "~> 0.1.0"],
10
+ "grape" => ["grape-instrumentation", "~> 0.2.0"],
11
11
  "mongodb" => ["mongodb-instrumentation", "~> 0.1.1"],
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", { git: 'git://github.com/signalfx/ruby-rack-tracer.git', branch: 'sfx_release' }],
16
- "rails" => ["rails-instrumentation", "~> 0.1.3"],
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"],
@@ -1,12 +1,12 @@
1
1
  group :instrumentations do
2
2
  gem 'activerecord-opentracing', '~> 0.2.1'
3
- gem 'grape-instrumentation', "~> 0.1.0"
3
+ gem 'grape-instrumentation', "~> 0.2.0"
4
4
  gem 'mongodb-instrumentation', '~> 0.1.1'
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', git: 'git://github.com/signalfx/ruby-rack-tracer.git', branch: 'sfx_release'
9
- gem 'rails-instrumentation', '0.1.3'
8
+ gem 'sfx-rack-tracer', '~> 0.10.0'
9
+ gem 'rails-instrumentation', '~> 0.1.5'
10
10
  gem 'redis-instrumentation', '~> 0.2.0'
11
11
  gem 'restclient-instrumentation', '~> 0.1.1'
12
12
  gem 'sequel-instrumentation', '~> 0.1.0'
@@ -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 = Jaeger::Client.build(
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
@@ -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::Client::Tracer
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
@@ -1,5 +1,5 @@
1
1
  module Signalfx
2
2
  module Tracing
3
- VERSION = "1.4.1"
3
+ VERSION = "1.5.2"
4
4
  end
5
5
  end
@@ -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.16"
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"
@@ -34,6 +35,4 @@ Gem::Specification.new do |spec|
34
35
 
35
36
  # stdlib instrumentations
36
37
  spec.add_dependency "nethttp-instrumentation", "~> 0.1.2"
37
-
38
- spec.add_development_dependency 'signalfx-faraday-instrumentation~> 0.1.1', '~> 0'
39
38
  end
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.1
4
+ version: 1.5.2
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-09-08 00:00:00.000000000 Z
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.16'
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.16'
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
@@ -80,20 +94,6 @@ dependencies:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
96
  version: 0.1.2
83
- - !ruby/object:Gem::Dependency
84
- name: signalfx-faraday-instrumentation~> 0.1.1
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
97
  description:
98
98
  email:
99
99
  - info@signalfx.com
@@ -110,6 +110,7 @@ files:
110
110
  - bin/sfx-rb-trace-bootstrap
111
111
  - gem.deps.rb
112
112
  - lib/signalfx/tracing.rb
113
+ - lib/signalfx/tracing/client.rb
113
114
  - lib/signalfx/tracing/compat.rb
114
115
  - lib/signalfx/tracing/compat/phusion_passenger.rb
115
116
  - lib/signalfx/tracing/http_sender.rb
@@ -132,6 +133,7 @@ files:
132
133
  - lib/signalfx/tracing/register.rb
133
134
  - lib/signalfx/tracing/reporter/auto_reviving_async_reporter.rb
134
135
  - lib/signalfx/tracing/sfx_logger.rb
136
+ - lib/signalfx/tracing/span.rb
135
137
  - lib/signalfx/tracing/tags.rb
136
138
  - lib/signalfx/tracing/tracer.rb
137
139
  - lib/signalfx/tracing/version.rb
@@ -155,8 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
157
  - !ruby/object:Gem::Version
156
158
  version: '0'
157
159
  requirements: []
158
- rubyforge_project:
159
- rubygems_version: 2.7.6.2
160
+ rubygems_version: 3.1.2
160
161
  signing_key:
161
162
  specification_version: 4
162
163
  summary: Auto-instrumentation framework for Ruby