opentelemetry-instrumentation-action_pack 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -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 +1 -14
- data/lib/opentelemetry/instrumentation/action_pack/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5cec65fd3dd369bac557558ba0a0f53555d608070e06f108de4f4838faaf857
|
4
|
+
data.tar.gz: 694b4b57f041a383b00d1d4d00b51bab8529b2b94c9edfd5d2c39d50c09a0bd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6776c13298cb78ffc6fc3ed403def8aa75248db1962c28e4e1c05c066dd29eaaea7c5affc79916ee08dfb6a7972273c2b002fc6cfdd69bd41634c2bf3829778b
|
7
|
+
data.tar.gz: b0ec634bd5c2fcc53ff685ea0834d6911c55374af1fa8ead7ac81c4dd8bb6ee036d828e633f4aa75617c3f541938e4be2476509f78d06bd9f60876899bbeaed3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-action_pack
|
2
2
|
|
3
|
+
### v0.4.0 / 2022-12-06
|
4
|
+
|
5
|
+
* BREAKING CHANGE: Remove enable_recognize_route and span_naming options
|
6
|
+
|
7
|
+
* FIXED: Remove enable_recognize_route and span_naming options
|
8
|
+
|
3
9
|
### v0.3.2 / 2022-11-16
|
4
10
|
|
5
11
|
* * 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
21
|
OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => 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.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: 2022-
|
11
|
+
date: 2022-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -242,10 +242,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-contrib
|
|
242
242
|
licenses:
|
243
243
|
- Apache-2.0
|
244
244
|
metadata:
|
245
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-action_pack/v0.
|
245
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-action_pack/v0.4.0/file.CHANGELOG.html
|
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://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-action_pack/v0.
|
248
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-action_pack/v0.4.0
|
249
249
|
post_install_message:
|
250
250
|
rdoc_options: []
|
251
251
|
require_paths:
|