opentelemetry-instrumentation-action_pack 0.3.2 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +0 -18
- data/lib/opentelemetry/instrumentation/action_pack/instrumentation.rb +0 -3
- data/lib/opentelemetry/instrumentation/action_pack/patches/action_controller/metal.rb +2 -15
- data/lib/opentelemetry/instrumentation/action_pack/version.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 388f9fbed50d78d291eaa2bf05dab31f56186c9590e5da9c16a7d0822ccfabbf
|
4
|
+
data.tar.gz: 0fb1375a95d864a463745be2938b9e13d1b98068b62a6c21b0c7d22b0df6b33f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9194a51cf36b8324d9b8d867b55d9f0c37f1ab464cf106e61abfb9c0150ef4e7c6edf2de54b265b124e15db41c34ae0afb131d259140b63a29ed90f35ac288b6
|
7
|
+
data.tar.gz: 2c46ae0869e6ae29f46e1e0c7cec0b14adfbc89e6728d7996d54729965f2872a657b78a6de2a535dd3a0c10b6fe056781127c0889f112d61838999a455ec35ac
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-action_pack
|
2
2
|
|
3
|
+
### v0.4.1 / 2023-01-14
|
4
|
+
|
5
|
+
* DOCS: Fix gem homepage
|
6
|
+
* DOCS: More gem documentation fixes
|
7
|
+
|
8
|
+
### v0.4.0 / 2022-12-06
|
9
|
+
|
10
|
+
* BREAKING CHANGE: Remove enable_recognize_route and span_naming options
|
11
|
+
|
12
|
+
* FIXED: Remove enable_recognize_route and span_naming options
|
13
|
+
|
3
14
|
### v0.3.2 / 2022-11-16
|
4
15
|
|
5
16
|
* * FIXED: Loosen dependency on Rack
|
data/README.md
CHANGED
@@ -30,24 +30,6 @@ OpenTelemetry::SDK.configure do |c|
|
|
30
30
|
end
|
31
31
|
```
|
32
32
|
|
33
|
-
### Configuration options
|
34
|
-
|
35
|
-
| Name | Default | Description |
|
36
|
-
| ----- | ------- | ----------- |
|
37
|
-
| `span_naming` | `:rails_route` | Configures the name for the Rack span. `:rails_route` is in the format of `HTTP_METHOD /rails/route(.:format)`, for example `GET /users/:id(.:format)`. `:controller_action` is in the format of `Controller#action`, for example `UsersController#show` |
|
38
|
-
| `enable_recognize_route` | `true` | Enables or disables adding the `http.route` attribute. |
|
39
|
-
|
40
|
-
The default configuration uses a [method from Rails to obtain the route for the request](https://github.com/rails/rails/blob/v6.1.3/actionpack/lib/action_dispatch/journey/router.rb#L65). The options above allow this behaviour to be opted out of if you have performance issues. If you wish to avoid using this method then set `span_naming: :controller_action, enable_recognize_route: false`.
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
OpenTelemetry::SDK.configure do |c|
|
44
|
-
c.use 'OpenTelemetry::Instrumentation::ActionPack', {
|
45
|
-
span_naming: :controller_action,
|
46
|
-
enable_recognize_route: false
|
47
|
-
}
|
48
|
-
end
|
49
|
-
```
|
50
|
-
|
51
33
|
## Examples
|
52
34
|
|
53
35
|
Example usage can be seen in the `./example/trace_demonstration.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/action_pack/example/trace_demonstration.ru)
|
@@ -25,9 +25,6 @@ module OpenTelemetry
|
|
25
25
|
gem_version >= MINIMUM_VERSION
|
26
26
|
end
|
27
27
|
|
28
|
-
option :enable_recognize_route, default: true, validate: :boolean
|
29
|
-
option :span_naming, default: :rails_route, validate: %i[controller_action rails_route]
|
30
|
-
|
31
28
|
private
|
32
29
|
|
33
30
|
def gem_version
|
@@ -14,18 +14,12 @@ module OpenTelemetry
|
|
14
14
|
def dispatch(name, request, response)
|
15
15
|
rack_span = OpenTelemetry::Instrumentation::Rack.current_span
|
16
16
|
if rack_span.recording?
|
17
|
-
unless request.env['action_dispatch.exception']
|
18
|
-
rack_span.name = case instrumentation_config[:span_naming]
|
19
|
-
when :controller_action then "#{self.class.name}##{name}"
|
20
|
-
else "#{request.method} #{rails_route(request)}"
|
21
|
-
end
|
22
|
-
end
|
17
|
+
rack_span.name = "#{self.class.name}##{name}" unless request.env['action_dispatch.exception']
|
23
18
|
|
24
19
|
attributes_to_append = {
|
25
20
|
OpenTelemetry::SemanticConventions::Trace::CODE_NAMESPACE => self.class.name,
|
26
|
-
OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => name
|
21
|
+
OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => String(name)
|
27
22
|
}
|
28
|
-
attributes_to_append[OpenTelemetry::SemanticConventions::Trace::HTTP_ROUTE] = rails_route(request) if instrumentation_config[:enable_recognize_route]
|
29
23
|
attributes_to_append[OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET] = request.filtered_path if request.filtered_path != request.fullpath
|
30
24
|
rack_span.add_attributes(attributes_to_append)
|
31
25
|
end
|
@@ -35,13 +29,6 @@ module OpenTelemetry
|
|
35
29
|
|
36
30
|
private
|
37
31
|
|
38
|
-
def rails_route(request)
|
39
|
-
@rails_route ||= ::Rails.application.routes.router.recognize(request) do |route, _params|
|
40
|
-
return route.path.spec.to_s
|
41
|
-
# Rails will match on the first route - see https://guides.rubyonrails.org/routing.html#crud-verbs-and-actions
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
32
|
def instrumentation_config
|
46
33
|
ActionPack::Instrumentation.instance.config
|
47
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-instrumentation-action_pack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
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: 2023-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.4'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '2.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,28 +142,28 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: '13.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: '13.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rubocop
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
159
|
+
version: 1.41.1
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
166
|
+
version: 1.41.1
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: simplecov
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -238,14 +238,14 @@ files:
|
|
238
238
|
- lib/opentelemetry/instrumentation/action_pack/patches/action_controller/metal.rb
|
239
239
|
- lib/opentelemetry/instrumentation/action_pack/railtie.rb
|
240
240
|
- lib/opentelemetry/instrumentation/action_pack/version.rb
|
241
|
-
homepage: https://github.com/open-telemetry/opentelemetry-contrib
|
241
|
+
homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
242
242
|
licenses:
|
243
243
|
- Apache-2.0
|
244
244
|
metadata:
|
245
|
-
changelog_uri: https://
|
245
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_pack/0.4.1/file/CHANGELOG.md
|
246
246
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/action_pack
|
247
247
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
248
|
-
documentation_uri: https://
|
248
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_pack/0.4.1
|
249
249
|
post_install_message:
|
250
250
|
rdoc_options: []
|
251
251
|
require_paths:
|