signalfx-tracing 1.4.3 → 1.5.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
  SHA256:
3
- metadata.gz: 1d8084beade571589adf44ec1abf80119b97ec39a003cbbb140ea4c773295988
4
- data.tar.gz: 117f57ee3d8c08085774660863c10aa80c2cc0b8c39447519ce0372ac41e85b5
3
+ metadata.gz: 9fcec71a1be65bd56fb2e5457c52cdc539f6e13944684cf3b8ab46e45860eef4
4
+ data.tar.gz: b53568f3b9f9b1e938f34e07388a3922851bf157ae5549c96040d4b0c5a13edf
5
5
  SHA512:
6
- metadata.gz: 8827b0f0b970821aa91b193256d1e7ab0c080bb740421f6739fd2446a4e06e56eb38ea38fef65d3b94efaa7487d642ab9101e2bc61eb2ebbaa1e3c819fc3144c
7
- data.tar.gz: 0caaf7c27b8510d3f2473775787496e52a2386e052f24c380bf9584c2c24a21a1750e1e4475a5c727dc1281b403f7280e8aa3bf88a3c845edcd883b38ecf138a
6
+ metadata.gz: b898b02c85dda9af08f3f18eeaeb9df693f866e88742d0ace0a9329e9f9eca44494f10ae810bed359b8159a6d71033f7a2be679da66024070673621274be0f19
7
+ data.tar.gz: 12875b259e36ff96485575085f881def7fb7b806842b33b5aa3601f407ce98b0785d63e61416232439636da8c0e783aa107797512a135cc6cbb726053e3932d6
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ /vendor/
1
2
  *.lock
2
3
  *.gem
3
4
  .idea
@@ -12,7 +12,7 @@ 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", { git: 'git://github.com/signalfx/ruby-rack-tracer.git', branch: 'sfx_release' }],
15
+ "rack" => ["sfx-rack-tracer", "~> 0.10.0"],
16
16
  "rails" => ["rails-instrumentation", "~> 0.1.5"],
17
17
  "redis" => ["redis-instrumentation", "~> 0.2.0"],
18
18
  "restclient" => ["restclient-instrumentation", "~> 0.1.1"],
@@ -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.3"
3
+ VERSION = "1.5.0"
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"
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.3
4
+ version: 1.5.0
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-11 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
@@ -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