sidekiq-instrumentation 1.2.1 → 1.2.2.ejacobs1

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: 15a4684ee4a4994dc8a76c0e7d0905dd498a06a58f619066ceb0ff089d3df379
4
- data.tar.gz: 1fee9c0892325630863049961ce5f4e0f1c00a934d6f23e0ccdf34cc5cd16b4d
3
+ metadata.gz: 332c892cee99ef96c6d9d1cb8022b1492b37907ec3f494c033460061fab39dd2
4
+ data.tar.gz: 8e6172fec42f502ff1ad80ebfd1a13a06ea040ea73190456dfa172520aa656b5
5
5
  SHA512:
6
- metadata.gz: 7d68879b7e44765920ec54f006d6aa2bc8222f2de00080dacbace7306f33f32ccc15326b1a6813973109ce5db81b46128471fb5879aeac0011a5a3b2b8c3df21
7
- data.tar.gz: 6036c4aac84429b921a2003c61d0076eb5775efbb67bd07fb1c7d0a048e8aa78e63529d38e92aa82aca1a77dd9d5655ec3609f54c0719c8285fd4aef171f872f
6
+ metadata.gz: 4c40967f6cb33f99e827c43fd39fc5bd1c488cb62eee62f939f8e99d9d63673d2d2df7e39da13ddf8de0a51bffb113065a264d7da5c2bb6406361ae26033eb68
7
+ data.tar.gz: 6e6ad4257a86594557c290b0d46a9631dfae0229a5052241da779dd580fb583bb0ad6615fe5ecfe33f20307eeccbc57669a7ec517b5c9a38b4fef6638d67cf7e
@@ -1,6 +1,10 @@
1
1
 
2
2
  Changelog
3
3
  =========
4
+
5
+ ## 1.2.2.ejacobs1 09/08/2020
6
+ * Add optional after_trace hook to ClientMiddleware
7
+
4
8
  ## 1.2.1 07/09/2020
5
9
  * Ensure child spans are nested under the root Sidekiq span in the trace
6
10
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sidekiq-instrumentation (1.2.1)
4
+ sidekiq-instrumentation (1.2.2.ejacobs1)
5
5
  opentracing (>= 0.3.1)
6
6
 
7
7
  GEM
@@ -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,11 +5,12 @@ 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
 
15
16
  # rubocop:disable Metrics/MethodLength
@@ -27,6 +28,8 @@ module Sidekiq
27
28
  rescue StandardError => e
28
29
  tag_errors(scope.span, e) if scope.span
29
30
  raise
31
+ ensure
32
+ after_trace&.call(scope.span) if scope.span
30
33
  end
31
34
  end
32
35
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Tracer
5
- VERSION = "1.2.1"
5
+ VERSION = "1.2.2.ejacobs1"
6
6
  end
7
7
  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.2.1
4
+ version: 1.2.2.ejacobs1
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-07-09 00:00:00.000000000 Z
12
+ date: 2020-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: opentracing
@@ -204,9 +204,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
204
  version: '0'
205
205
  required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  requirements:
207
- - - ">="
207
+ - - ">"
208
208
  - !ruby/object:Gem::Version
209
- version: '0'
209
+ version: 1.3.1
210
210
  requirements: []
211
211
  rubygems_version: 3.1.2
212
212
  signing_key: