opentelemetry-instrumentation-active_support 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1852a8b123120f16f182d8c90a618c1fa26199e55bd7cbec455131f43f69b4f6
|
4
|
+
data.tar.gz: 2f6e719ac8a31dc081020cec7dadfc4dc79077bd567d0dc7e67eb4d8ffda0c3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bbe103450f24ceb73320c6703a4c560c0140919f0dc4a970b405c758b97fdc7638f84f7a05d348d80423717f6a0864f351a3efd5da4ca7875b0ae775440cbab
|
7
|
+
data.tar.gz: e26a15ede4719613f77efc98c00d4fc1e1dc38948e2dd77262dbbcfa5faea59e5d5cf870f13c5446d93250eaecbbb9a802f00e8ba462cd88c694cb7310964df0
|
data/CHANGELOG.md
CHANGED
@@ -8,13 +8,16 @@ module OpenTelemetry
|
|
8
8
|
module Instrumentation
|
9
9
|
# rubocop:disable Style/Documentation
|
10
10
|
module ActiveSupport
|
11
|
+
NOTIFIER_MAJOR_VERSION_6 = 6
|
12
|
+
|
11
13
|
# The SpanSubscriber is a special ActiveSupport::Notification subscription
|
12
14
|
# handler which turns notifications into generic spans, taking care to handle
|
13
15
|
# context appropriately.
|
14
16
|
|
15
17
|
# A very hacky way to make sure that OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscriber
|
16
18
|
# gets invoked first
|
17
|
-
#
|
19
|
+
# Rails 6+ https://github.com/rails/rails/blob/0f0ec9908e25af36df2d937dc431f626a4102b3d/activesupport/lib/active_support/notifications/fanout.rb#L51
|
20
|
+
# Rails 5 https://github.com/rails/rails/blob/8030cff808657faa44828de001cd3b80364597de/activesupport/lib/active_support/notifications/fanout.rb#L16
|
18
21
|
def self.subscribe(
|
19
22
|
tracer,
|
20
23
|
pattern,
|
@@ -29,18 +32,36 @@ module OpenTelemetry
|
|
29
32
|
)
|
30
33
|
|
31
34
|
subscriber_object = ::ActiveSupport::Notifications.subscribe(pattern, subscriber)
|
35
|
+
|
32
36
|
::ActiveSupport::Notifications.notifier.synchronize do
|
33
|
-
|
34
|
-
|
35
|
-
|
37
|
+
subscribers = find_subscribers(pattern)
|
38
|
+
|
39
|
+
if subscribers.nil?
|
40
|
+
OpenTelemetry.handle_error(
|
41
|
+
message: 'Unable to move OTEL ActiveSupport Notifications subscriber to the front of the notifications list which may cause incomplete traces.' \
|
42
|
+
'Please report an issue here: ' \
|
43
|
+
'https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues/new?labels=bug&template=bug_report.md&title=ActiveSupport%20Notifications%20subscribers%20list%20is%20nil'
|
44
|
+
)
|
36
45
|
else
|
37
|
-
|
38
|
-
|
46
|
+
subscribers.unshift(
|
47
|
+
subscribers.delete(subscriber_object)
|
48
|
+
)
|
39
49
|
end
|
40
50
|
end
|
41
51
|
subscriber_object
|
42
52
|
end
|
43
53
|
|
54
|
+
def self.find_subscribers(pattern)
|
55
|
+
active_support_major_version = ::ActiveSupport.version.canonical_segments.first
|
56
|
+
|
57
|
+
# TODO: Drop support for Rails 5 since it is EOL since 2022-06-01
|
58
|
+
if active_support_major_version >= NOTIFIER_MAJOR_VERSION_6
|
59
|
+
::ActiveSupport::Notifications.notifier.instance_variable_get(:@string_subscribers)[pattern]
|
60
|
+
else
|
61
|
+
::ActiveSupport::Notifications.notifier.instance_variable_get(:@subscribers)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
44
65
|
class SpanSubscriber
|
45
66
|
ALWAYS_VALID_PAYLOAD_TYPES = [TrueClass, FalseClass, String, Numeric, Symbol].freeze
|
46
67
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-instrumentation-active_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenTelemetry Authors
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.21.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
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: appraisal
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,10 +269,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
255
269
|
licenses:
|
256
270
|
- Apache-2.0
|
257
271
|
metadata:
|
258
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_support/0.2.
|
272
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_support/0.2.2/file/CHANGELOG.md
|
259
273
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/active_support
|
260
274
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
261
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_support/0.2.
|
275
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_support/0.2.2
|
262
276
|
post_install_message:
|
263
277
|
rdoc_options: []
|
264
278
|
require_paths:
|