opentelemetry-instrumentation-active_support 0.5.3 → 0.7.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: 0bf8dd0e4f9a435db3e6ec148bf76041d50e40693ecc6bb74b99c155776452cf
|
4
|
+
data.tar.gz: f7e0a0b64847640c8f1fc037787b3be298eda876a91f166593fb6b7f148fd4e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a49996e289ea5a04a97f30f28e13644d6e79fdf3f52b8ca95ac379d2adea111d5a2cc12e7b2220644f9f80361b8bd22da0170df3192d3c0114468b018c31df83
|
7
|
+
data.tar.gz: 1ae33a494594deefa620ec816252e41adb79d80c7200e8ba7828acc238982309bbb17497e24eb74b9f943093de3276ea33f0ebf68a7b071cfad3b4a8bd444305
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-active_support
|
2
2
|
|
3
|
+
### v0.7.0 / 2024-12-19
|
4
|
+
|
5
|
+
* ADDED: Enable support for `Regexp` patterns when subscribing to Active Support's instrumentation Events
|
6
|
+
|
7
|
+
### v0.6.0 / 2024-07-02
|
8
|
+
|
9
|
+
* BREAKING CHANGE: Custom ActiveSupport Span Names
|
10
|
+
|
11
|
+
* ADDED: Custom ActiveSupport Span Names
|
12
|
+
|
3
13
|
### v0.5.3 / 2024-06-20
|
4
14
|
|
5
15
|
* FIXED: Include span kind in ActiveSupport Instrumentation helper
|
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
|
@@ -42,7 +48,7 @@ Example usage can be seen in the `./example/trace_demonstration.rb` file [here](
|
|
42
48
|
|
43
49
|
The `opentelemetry-instrumentation-active_support` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
|
44
50
|
|
45
|
-
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry
|
51
|
+
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry Ruby special interest group (SIG). You can get involved by joining us on our [GitHub Discussions][discussions-url], [Slack Channel][slack-channel] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
|
46
52
|
|
47
53
|
## License
|
48
54
|
|
@@ -54,4 +60,5 @@ The `opentelemetry-instrumentation-active_support` gem is distributed under the
|
|
54
60
|
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
|
55
61
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
56
62
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
63
|
+
[slack-channel]: https://cloud-native.slack.com/archives/C01NWKKMKMY
|
57
64
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
@@ -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,15 +22,17 @@ module OpenTelemetry
|
|
19
22
|
tracer,
|
20
23
|
pattern,
|
21
24
|
notification_payload_transform = nil,
|
22
|
-
disallowed_notification_payload_keys =
|
23
|
-
kind: nil
|
25
|
+
disallowed_notification_payload_keys = nil,
|
26
|
+
kind: nil,
|
27
|
+
span_name_formatter: nil
|
24
28
|
)
|
25
29
|
subscriber = OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscriber.new(
|
26
|
-
|
30
|
+
pattern: pattern,
|
27
31
|
tracer: tracer,
|
28
32
|
notification_payload_transform: notification_payload_transform,
|
29
33
|
disallowed_notification_payload_keys: disallowed_notification_payload_keys,
|
30
|
-
kind: kind
|
34
|
+
kind: kind,
|
35
|
+
span_name_formatter: span_name_formatter
|
31
36
|
)
|
32
37
|
|
33
38
|
subscriber_object = ::ActiveSupport::Notifications.subscribe(pattern, subscriber)
|
@@ -54,19 +59,23 @@ module OpenTelemetry
|
|
54
59
|
subscriber_object
|
55
60
|
end
|
56
61
|
|
62
|
+
# rubocop:enable Metrics/ParameterLists
|
57
63
|
class SpanSubscriber
|
58
64
|
ALWAYS_VALID_PAYLOAD_TYPES = [TrueClass, FalseClass, String, Numeric, Symbol].freeze
|
59
65
|
|
60
|
-
|
61
|
-
|
66
|
+
# rubocop:disable Metrics/ParameterLists
|
67
|
+
def initialize(pattern:, tracer:, notification_payload_transform: nil, disallowed_notification_payload_keys: nil, kind: nil, span_name_formatter: nil)
|
68
|
+
@pattern = pattern
|
62
69
|
@tracer = tracer
|
63
70
|
@notification_payload_transform = notification_payload_transform
|
64
|
-
@disallowed_notification_payload_keys = disallowed_notification_payload_keys
|
71
|
+
@disallowed_notification_payload_keys = Array(disallowed_notification_payload_keys)
|
65
72
|
@kind = kind || :internal
|
73
|
+
@span_name_formatter = span_name_formatter
|
66
74
|
end
|
75
|
+
# rubocop:enable Metrics/ParameterLists
|
67
76
|
|
68
77
|
def start(name, id, payload)
|
69
|
-
span = @tracer.start_span(
|
78
|
+
span = @tracer.start_span(safe_span_name_for(name), kind: @kind)
|
70
79
|
token = OpenTelemetry::Context.attach(
|
71
80
|
OpenTelemetry::Trace.context_with_span(span)
|
72
81
|
)
|
@@ -128,6 +137,16 @@ module OpenTelemetry
|
|
128
137
|
value
|
129
138
|
end
|
130
139
|
end
|
140
|
+
|
141
|
+
# Helper method to try an shield the span name formatter from errors
|
142
|
+
#
|
143
|
+
# It wraps the user supplied formatter in a rescue block and returns the original name if a StandardError is raised by the formatter
|
144
|
+
def safe_span_name_for(name)
|
145
|
+
@span_name_formatter&.call(name) || name
|
146
|
+
rescue StandardError => e
|
147
|
+
OpenTelemetry.handle_error(exception: e, message: 'Error calling span_name_formatter. Using default span name.')
|
148
|
+
name
|
149
|
+
end
|
131
150
|
end
|
132
151
|
end
|
133
152
|
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.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenTelemetry Authors
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-19 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.69.1
|
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.69.1
|
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:
|
215
|
+
version: 1.23.0
|
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:
|
222
|
+
version: 1.23.0
|
209
223
|
- !ruby/object:Gem::Dependency
|
210
224
|
name: simplecov
|
211
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,14 +240,14 @@ dependencies:
|
|
226
240
|
requirements:
|
227
241
|
- - "~>"
|
228
242
|
- !ruby/object:Gem::Version
|
229
|
-
version:
|
243
|
+
version: 3.24.0
|
230
244
|
type: :development
|
231
245
|
prerelease: false
|
232
246
|
version_requirements: !ruby/object:Gem::Requirement
|
233
247
|
requirements:
|
234
248
|
- - "~>"
|
235
249
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
250
|
+
version: 3.24.0
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
252
|
name: yard
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -269,11 +283,11 @@ 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.7.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.
|
276
|
-
post_install_message:
|
289
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_support/0.7.0
|
290
|
+
post_install_message:
|
277
291
|
rdoc_options: []
|
278
292
|
require_paths:
|
279
293
|
- lib
|
@@ -289,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
289
303
|
version: '0'
|
290
304
|
requirements: []
|
291
305
|
rubygems_version: 3.2.33
|
292
|
-
signing_key:
|
306
|
+
signing_key:
|
293
307
|
specification_version: 4
|
294
308
|
summary: ActiveSupport instrumentation for the OpenTelemetry framework
|
295
309
|
test_files: []
|