opentelemetry-instrumentation-active_support 0.5.1 → 0.6.0
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: 8fb96f6aa88f3f2cfcef205f3c8b35d4aadcd5deb88f96cece9dd0483a9d651b
|
|
4
|
+
data.tar.gz: 2e182a42afc7147b758a1bb70e8f3aed10b2a427781be74f039046081f680cd4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c92ea1d46342f741e4773b5d4776fc1fa3cbef1dad880958e2a19a6d747b8c604ded8dff1f619a34787f4c24be206b13d6fb14dae9975c79d26fde764a90e1d1
|
|
7
|
+
data.tar.gz: 8fa040cf4aa404157181d6907be56d695375fdd029c3f82aa7f261548a34905bf0dd1d57231cd5a5a686de29d49882583622c62004ddeebb539e7780fd558c57
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Release History: opentelemetry-instrumentation-active_support
|
|
2
2
|
|
|
3
|
+
### v0.6.0 / 2024-07-02
|
|
4
|
+
|
|
5
|
+
* BREAKING CHANGE: Custom ActiveSupport Span Names
|
|
6
|
+
|
|
7
|
+
* ADDED: Custom ActiveSupport Span Names
|
|
8
|
+
|
|
9
|
+
### v0.5.3 / 2024-06-20
|
|
10
|
+
|
|
11
|
+
* FIXED: Include span kind in ActiveSupport Instrumentation helper
|
|
12
|
+
|
|
13
|
+
### v0.5.2 / 2024-06-20
|
|
14
|
+
|
|
15
|
+
* ADDED: ActiveSupport user specified span kind
|
|
16
|
+
|
|
3
17
|
### v0.5.1 / 2023-11-23
|
|
4
18
|
|
|
5
19
|
* CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
|
data/README.md
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# OpenTelemetry ActiveSupport Instrumentation
|
|
2
|
+
|
|
2
3
|
The Active Support instrumentation is a community-maintained instrumentation for the Active Support portion of the [Ruby on Rails][rails-home] web-application framework.
|
|
3
4
|
|
|
4
5
|
## How do I get started?
|
|
5
6
|
|
|
6
7
|
Install the gem using:
|
|
7
8
|
|
|
8
|
-
```
|
|
9
|
+
```console
|
|
10
|
+
|
|
9
11
|
gem install opentelemetry-instrumentation-active_support
|
|
12
|
+
|
|
10
13
|
```
|
|
11
14
|
|
|
12
15
|
Or, if you use [bundler][bundler-home], include `opentelemetry-instrumentation-active_support` in your `Gemfile`.
|
|
@@ -17,21 +20,24 @@ To use the instrumentation, call `use` with the name of the instrumentation and
|
|
|
17
20
|
to desired ActiveSupport notification:
|
|
18
21
|
|
|
19
22
|
```ruby
|
|
23
|
+
|
|
20
24
|
OpenTelemetry::SDK.configure do |c|
|
|
21
25
|
c.use 'OpenTelemetry::Instrumentation::ActiveSupport'
|
|
22
26
|
end
|
|
23
27
|
|
|
24
|
-
|
|
25
28
|
tracer = OpenTelemetry.tracer_provider.tracer('my_app_or_gem', '0.1.0')
|
|
26
29
|
::OpenTelemetry::Instrumentation::ActiveSupport.subscribe(tracer, 'bar.foo')
|
|
30
|
+
|
|
27
31
|
```
|
|
28
32
|
|
|
29
33
|
Alternatively, you can also call `use_all` to install all the available instrumentation.
|
|
30
34
|
|
|
31
35
|
```ruby
|
|
36
|
+
|
|
32
37
|
OpenTelemetry::SDK.configure do |c|
|
|
33
38
|
c.use_all
|
|
34
39
|
end
|
|
40
|
+
|
|
35
41
|
```
|
|
36
42
|
|
|
37
43
|
## Examples
|
|
@@ -8,6 +8,9 @@ module OpenTelemetry
|
|
|
8
8
|
module Instrumentation
|
|
9
9
|
# rubocop:disable Style/Documentation
|
|
10
10
|
module ActiveSupport
|
|
11
|
+
LEGACY_NAME_FORMATTER = ->(name) { name.split('.')[0..1].reverse.join(' ') }
|
|
12
|
+
|
|
13
|
+
# rubocop:disable Metrics/ParameterLists
|
|
11
14
|
# The SpanSubscriber is a special ActiveSupport::Notification subscription
|
|
12
15
|
# handler which turns notifications into generic spans, taking care to handle
|
|
13
16
|
# context appropriately.
|
|
@@ -19,13 +22,17 @@ module OpenTelemetry
|
|
|
19
22
|
tracer,
|
|
20
23
|
pattern,
|
|
21
24
|
notification_payload_transform = nil,
|
|
22
|
-
disallowed_notification_payload_keys =
|
|
25
|
+
disallowed_notification_payload_keys = nil,
|
|
26
|
+
kind: nil,
|
|
27
|
+
span_name_formatter: nil
|
|
23
28
|
)
|
|
24
29
|
subscriber = OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscriber.new(
|
|
25
30
|
name: pattern,
|
|
26
31
|
tracer: tracer,
|
|
27
32
|
notification_payload_transform: notification_payload_transform,
|
|
28
|
-
disallowed_notification_payload_keys: disallowed_notification_payload_keys
|
|
33
|
+
disallowed_notification_payload_keys: disallowed_notification_payload_keys,
|
|
34
|
+
kind: kind,
|
|
35
|
+
span_name_formatter: span_name_formatter
|
|
29
36
|
)
|
|
30
37
|
|
|
31
38
|
subscriber_object = ::ActiveSupport::Notifications.subscribe(pattern, subscriber)
|
|
@@ -52,18 +59,22 @@ module OpenTelemetry
|
|
|
52
59
|
subscriber_object
|
|
53
60
|
end
|
|
54
61
|
|
|
62
|
+
# rubocop:enable Metrics/ParameterLists
|
|
55
63
|
class SpanSubscriber
|
|
56
64
|
ALWAYS_VALID_PAYLOAD_TYPES = [TrueClass, FalseClass, String, Numeric, Symbol].freeze
|
|
57
65
|
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
# rubocop:disable Metrics/ParameterLists
|
|
67
|
+
def initialize(name:, tracer:, notification_payload_transform: nil, disallowed_notification_payload_keys: nil, kind: nil, span_name_formatter: nil)
|
|
68
|
+
@span_name = safe_span_name_for(span_name_formatter, name).dup.freeze
|
|
60
69
|
@tracer = tracer
|
|
61
70
|
@notification_payload_transform = notification_payload_transform
|
|
62
|
-
@disallowed_notification_payload_keys = disallowed_notification_payload_keys
|
|
71
|
+
@disallowed_notification_payload_keys = Array(disallowed_notification_payload_keys)
|
|
72
|
+
@kind = kind || :internal
|
|
63
73
|
end
|
|
74
|
+
# rubocop:enable Metrics/ParameterLists
|
|
64
75
|
|
|
65
76
|
def start(name, id, payload)
|
|
66
|
-
span = @tracer.start_span(@span_name, kind:
|
|
77
|
+
span = @tracer.start_span(@span_name, kind: @kind)
|
|
67
78
|
token = OpenTelemetry::Context.attach(
|
|
68
79
|
OpenTelemetry::Trace.context_with_span(span)
|
|
69
80
|
)
|
|
@@ -125,6 +136,16 @@ module OpenTelemetry
|
|
|
125
136
|
value
|
|
126
137
|
end
|
|
127
138
|
end
|
|
139
|
+
|
|
140
|
+
# Helper method to try an shield the span name formatter from errors
|
|
141
|
+
#
|
|
142
|
+
# It wraps the user supplied formatter in a rescue block and returns the original name if a StandardError is raised by the formatter
|
|
143
|
+
def safe_span_name_for(span_name_formatter, name)
|
|
144
|
+
span_name_formatter&.call(name) || name
|
|
145
|
+
rescue StandardError => e
|
|
146
|
+
OpenTelemetry.handle_error(exception: e, message: 'Error calling span_name_formatter. Using default span name.')
|
|
147
|
+
name
|
|
148
|
+
end
|
|
128
149
|
end
|
|
129
150
|
end
|
|
130
151
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opentelemetry-instrumentation-active_support
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenTelemetry Authors
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-07-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: opentelemetry-api
|
|
@@ -178,34 +178,48 @@ dependencies:
|
|
|
178
178
|
- - "~>"
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
180
|
version: '13.0'
|
|
181
|
+
- !ruby/object:Gem::Dependency
|
|
182
|
+
name: rspec-mocks
|
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
|
184
|
+
requirements:
|
|
185
|
+
- - ">="
|
|
186
|
+
- !ruby/object:Gem::Version
|
|
187
|
+
version: '0'
|
|
188
|
+
type: :development
|
|
189
|
+
prerelease: false
|
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
191
|
+
requirements:
|
|
192
|
+
- - ">="
|
|
193
|
+
- !ruby/object:Gem::Version
|
|
194
|
+
version: '0'
|
|
181
195
|
- !ruby/object:Gem::Dependency
|
|
182
196
|
name: rubocop
|
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
|
184
198
|
requirements:
|
|
185
199
|
- - "~>"
|
|
186
200
|
- !ruby/object:Gem::Version
|
|
187
|
-
version: 1.
|
|
201
|
+
version: 1.64.0
|
|
188
202
|
type: :development
|
|
189
203
|
prerelease: false
|
|
190
204
|
version_requirements: !ruby/object:Gem::Requirement
|
|
191
205
|
requirements:
|
|
192
206
|
- - "~>"
|
|
193
207
|
- !ruby/object:Gem::Version
|
|
194
|
-
version: 1.
|
|
208
|
+
version: 1.64.0
|
|
195
209
|
- !ruby/object:Gem::Dependency
|
|
196
210
|
name: rubocop-performance
|
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|
|
198
212
|
requirements:
|
|
199
213
|
- - "~>"
|
|
200
214
|
- !ruby/object:Gem::Version
|
|
201
|
-
version: 1.
|
|
215
|
+
version: '1.20'
|
|
202
216
|
type: :development
|
|
203
217
|
prerelease: false
|
|
204
218
|
version_requirements: !ruby/object:Gem::Requirement
|
|
205
219
|
requirements:
|
|
206
220
|
- - "~>"
|
|
207
221
|
- !ruby/object:Gem::Version
|
|
208
|
-
version: 1.
|
|
222
|
+
version: '1.20'
|
|
209
223
|
- !ruby/object:Gem::Dependency
|
|
210
224
|
name: simplecov
|
|
211
225
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -269,10 +283,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
|
269
283
|
licenses:
|
|
270
284
|
- Apache-2.0
|
|
271
285
|
metadata:
|
|
272
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_support/0.
|
|
286
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_support/0.6.0/file/CHANGELOG.md
|
|
273
287
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/active_support
|
|
274
288
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
|
275
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_support/0.
|
|
289
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_support/0.6.0
|
|
276
290
|
post_install_message:
|
|
277
291
|
rdoc_options: []
|
|
278
292
|
require_paths:
|