sidekiq-instrumentation 1.1.0 → 1.2.2.ejacobs2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +10 -1
- data/Gemfile.lock +3 -3
- data/lib/sidekiq/tracer.rb +7 -7
- data/lib/sidekiq/tracer/server_middleware.rb +20 -18
- data/lib/sidekiq/tracer/version.rb +1 -1
- data/sidekiq-instrumentation.gemspec +1 -1
- metadata +18 -20
- data/lib/sidekiq_instrumentation.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6641e2c0b30c4ddfd7647986e5608ff11499a87ac9923653c84fbad1c846f3f
|
4
|
+
data.tar.gz: ad72033e048cb3b70307854c938d98922b612f09f30ba945a1503ca099f92ccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93484dbfcaada95dbeda85518a74ec325fe6c7eeeeea3c153dfb3a4047c27abfcf93ec14dd758bcd6133096c9d8056ba636460f8a4453b59b0840b185313a2af
|
7
|
+
data.tar.gz: 0ae4b86fbb017feefa41ac53fef28896edeec0e6dc88d3a13441f1f2f96717e9e6d4f66f502ed4cf6ff4d5f68e22cb2f535df20f5d50562c049e6ef71ddf3f07
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,16 @@
|
|
2
2
|
Changelog
|
3
3
|
=========
|
4
4
|
|
5
|
+
## 1.2.2.ejacobs2 09/08/2020
|
6
|
+
* Add optional after_trace hook to ClientMiddleware
|
7
|
+
|
8
|
+
## 1.2.1 07/09/2020
|
9
|
+
* Ensure child spans are nested under the root Sidekiq span in the trace
|
10
|
+
|
11
|
+
## 1.2.0 05/28/2020
|
12
|
+
* Ignore active scope in consumers
|
13
|
+
|
5
14
|
## 1.1.0 05/27/2020
|
6
15
|
* Set up build pipeline with circleci and gem-publisher
|
7
16
|
* Fixed linting issues
|
8
|
-
* Renamed gem to `sidekiq-instrumentation`
|
17
|
+
* Renamed gem to `sidekiq-instrumentation`
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sidekiq-instrumentation (1.
|
4
|
+
sidekiq-instrumentation (1.2.2.ejacobs2)
|
5
5
|
opentracing (>= 0.3.1)
|
6
|
-
sidekiq
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://artifacts.dox.support/repository/gems/
|
@@ -85,9 +84,10 @@ DEPENDENCIES
|
|
85
84
|
rspec
|
86
85
|
rspec_junit_formatter
|
87
86
|
sdoc
|
87
|
+
sidekiq
|
88
88
|
sidekiq-instrumentation!
|
89
89
|
test-tracer (~> 1.0, >= 1.2.1)
|
90
90
|
tracing-matchers (~> 1.0, >= 1.3.0)
|
91
91
|
|
92
92
|
BUNDLED WITH
|
93
|
-
1.17.
|
93
|
+
1.17.3
|
data/lib/sidekiq/tracer.rb
CHANGED
@@ -11,9 +11,9 @@ require "sidekiq/tracer/server_middleware"
|
|
11
11
|
module Sidekiq
|
12
12
|
module Tracer
|
13
13
|
class << self
|
14
|
-
def instrument(tracer: OpenTracing.global_tracer, active_span: nil)
|
14
|
+
def instrument(tracer: OpenTracing.global_tracer, active_span: nil, after_trace: nil)
|
15
15
|
instrument_client(tracer: tracer, active_span: active_span)
|
16
|
-
instrument_server(tracer: tracer, active_span: active_span)
|
16
|
+
instrument_server(tracer: tracer, active_span: active_span, after_trace: after_trace)
|
17
17
|
end
|
18
18
|
|
19
19
|
def instrument_client(tracer: OpenTracing.global_tracer, active_span: nil)
|
@@ -22,23 +22,23 @@ module Sidekiq
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def instrument_server(tracer: OpenTracing.global_tracer, active_span: nil)
|
25
|
+
def instrument_server(tracer: OpenTracing.global_tracer, active_span: nil, after_trace: nil)
|
26
26
|
Sidekiq.configure_server do |config|
|
27
27
|
config.client_middleware { |chain| add_client_middleware(chain, tracer, active_span) }
|
28
|
-
config.server_middleware { |chain| add_server_middleware(chain, tracer, active_span) }
|
28
|
+
config.server_middleware { |chain| add_server_middleware(chain, tracer, active_span, after_trace) }
|
29
29
|
end
|
30
30
|
|
31
31
|
return unless defined?(Sidekiq::Testing)
|
32
32
|
|
33
|
-
Sidekiq::Testing.server_middleware { |chain| add_server_middleware(chain, tracer, active_span) }
|
33
|
+
Sidekiq::Testing.server_middleware { |chain| add_server_middleware(chain, tracer, active_span, after_trace) }
|
34
34
|
end
|
35
35
|
|
36
36
|
def add_client_middleware(chain, tracer, active_span)
|
37
37
|
chain.add Sidekiq::Tracer::ClientMiddleware, tracer: tracer, active_span: active_span
|
38
38
|
end
|
39
39
|
|
40
|
-
def add_server_middleware(chain, tracer, active_span)
|
41
|
-
chain.add Sidekiq::Tracer::ServerMiddleware, tracer: tracer, active_span: active_span
|
40
|
+
def add_server_middleware(chain, tracer, active_span, after_trace)
|
41
|
+
chain.add Sidekiq::Tracer::ServerMiddleware, tracer: tracer, active_span: active_span, after_trace: after_trace
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -5,35 +5,37 @@ module Sidekiq
|
|
5
5
|
class ServerMiddleware
|
6
6
|
include Commons
|
7
7
|
|
8
|
-
attr_reader :tracer, :active_span
|
8
|
+
attr_reader :tracer, :active_span, :after_trace
|
9
9
|
|
10
|
-
def initialize(tracer:, active_span:)
|
10
|
+
def initialize(tracer:, active_span:, after_trace:)
|
11
11
|
@tracer = tracer
|
12
12
|
@active_span = active_span
|
13
|
+
@after_trace = after_trace
|
13
14
|
end
|
14
15
|
|
16
|
+
# rubocop:disable Metrics/MethodLength
|
15
17
|
def call(_worker, job, _queue)
|
16
|
-
span = build_span(job)
|
17
|
-
|
18
|
-
yield
|
19
|
-
rescue StandardError => e
|
20
|
-
tag_errors(span, e) if span
|
21
|
-
raise
|
22
|
-
ensure
|
23
|
-
span&.finish
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def build_span(job)
|
29
18
|
parent_span_context = extract(job)
|
30
19
|
|
31
20
|
follows_from = OpenTracing::Reference.follows_from(parent_span_context)
|
32
21
|
|
33
|
-
tracer.
|
34
|
-
|
35
|
-
|
22
|
+
tracer.start_active_span(operation_name(job),
|
23
|
+
references: [follows_from],
|
24
|
+
ignore_active_scope: true,
|
25
|
+
tags: tags(job, "consumer")) do |scope|
|
26
|
+
begin
|
27
|
+
yield
|
28
|
+
rescue StandardError => e
|
29
|
+
tag_errors(scope.span, e) if scope.span
|
30
|
+
raise
|
31
|
+
ensure
|
32
|
+
after_trace&.call(scope.span) if scope.span
|
33
|
+
end
|
34
|
+
end
|
36
35
|
end
|
36
|
+
# rubocop:enable Metrics/MethodLength
|
37
|
+
|
38
|
+
private
|
37
39
|
|
38
40
|
def tag_errors(span, error)
|
39
41
|
span.set_tag("error", true)
|
@@ -23,7 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
25
|
spec.add_dependency "opentracing", ">= 0.3.1"
|
26
|
-
spec.add_dependency "sidekiq"
|
27
26
|
|
28
27
|
spec.add_development_dependency "bundler", "~> 1.17"
|
29
28
|
spec.add_development_dependency "dox-style"
|
@@ -31,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
31
30
|
spec.add_development_dependency "rspec"
|
32
31
|
spec.add_development_dependency "rspec_junit_formatter"
|
33
32
|
spec.add_development_dependency "sdoc"
|
33
|
+
spec.add_development_dependency "sidekiq"
|
34
34
|
spec.add_development_dependency "test-tracer", "~> 1.0", ">= 1.2.1"
|
35
35
|
spec.add_development_dependency "tracing-matchers", "~> 1.0", ">= 1.3.0"
|
36
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-instrumentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.2.ejacobs2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iaintshine
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: opentracing
|
@@ -25,20 +25,6 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 0.3.1
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: sidekiq
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: bundler
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +109,20 @@ dependencies:
|
|
123
109
|
- - ">="
|
124
110
|
- !ruby/object:Gem::Version
|
125
111
|
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: sidekiq
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: test-tracer
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,7 +174,6 @@ files:
|
|
174
174
|
- ".gitignore"
|
175
175
|
- ".rspec"
|
176
176
|
- ".rubocop.yml"
|
177
|
-
- ".ruby-version"
|
178
177
|
- ".travis.yml"
|
179
178
|
- CHANGELOG.md
|
180
179
|
- CODE_OF_CONDUCT.md
|
@@ -189,7 +188,6 @@ files:
|
|
189
188
|
- lib/sidekiq/tracer/constants.rb
|
190
189
|
- lib/sidekiq/tracer/server_middleware.rb
|
191
190
|
- lib/sidekiq/tracer/version.rb
|
192
|
-
- lib/sidekiq_instrumentation.rb
|
193
191
|
- sidekiq-instrumentation.gemspec
|
194
192
|
homepage: https://github.com/doximity/ruby-sidekiq-tracer
|
195
193
|
licenses:
|
@@ -206,9 +204,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
204
|
version: '0'
|
207
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
206
|
requirements:
|
209
|
-
- - "
|
207
|
+
- - ">"
|
210
208
|
- !ruby/object:Gem::Version
|
211
|
-
version:
|
209
|
+
version: 1.3.1
|
212
210
|
requirements: []
|
213
211
|
rubygems_version: 3.1.2
|
214
212
|
signing_key:
|