opentelemetry-instrumentation-action_pack 0.2.0 → 0.3.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: 90c97528fda46be9250fc027e888c9521f27ca9aec2e67e66cd75ee12ee165ea
4
- data.tar.gz: 0c727382b7453c5229a08d4bcc605abb1bd22a483abf351fd03dd55840aa97ca
3
+ metadata.gz: 9e808b337aa7f7d2b1f89d256b5fb47b1863713d562e31497b20feda46d9f8c8
4
+ data.tar.gz: 20dc3d8e3b3fd5adb37fdb7fac3b48f5a015c50bb57e26f2d7b22c202ced2258
5
5
  SHA512:
6
- metadata.gz: 287321106f107b978b0fb21703af64c875690143e4f6d3b2f08f7a79329f1fcd31d667676c27d89fbb480e13744e39aa5e5f20f4b9463ddf164cbe7efa9081ca
7
- data.tar.gz: 608f4a03a05c47517717275826ea99c60df0f4dfd77e592f10d98d4426098a70c65e12b27c0cc52d3fb7893703bef3fde66ee3c37cf4b777251b778e7572d294
6
+ metadata.gz: f52bf2948e572c80139a243ad0e9d1c95fcd60398a08e3a059f63b17721892faeed67a30e39a937e1edc50e521395a2bd8484cb94fd115dc5dd0e21994a6aa73
7
+ data.tar.gz: f5fd8391cb504a12a3674add3d203ff66750cc55394db7008f382ddce78118d68ff81973244bf2c25051a810b054a0620b61ab4d6f335879a93396f6a74e3ddd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-instrumentation-action_pack
2
2
 
3
+ ### v0.3.0 / 2022-10-14
4
+
5
+ * ADDED: Name ActionPack spans with the HTTP method and route
6
+
7
+ ### v0.2.1 / 2022-10-04
8
+
9
+ * FIXED: Ensures the correct route is add to http.route span attribute
10
+
3
11
  ### v0.2.0 / 2022-06-09
4
12
 
5
13
  * Upgrading Base dependency version
data/README.md CHANGED
@@ -43,7 +43,7 @@ end
43
43
 
44
44
  ## Examples
45
45
 
46
- Example usage can be seen in the `./example/trace_demonstration.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby/blob/main/instrumentation/action_pack/example/trace_demonstration.ru)
46
+ 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)
47
47
 
48
48
  ## How can I get involved?
49
49
 
@@ -57,7 +57,7 @@ The `opentelemetry-instrumentation-action_pack` gem is distributed under the Apa
57
57
 
58
58
  [bundler-home]: https://bundler.io
59
59
  [repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
60
- [license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
60
+ [license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
61
61
  [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
62
62
  [community-meetings]: https://github.com/open-telemetry/community#community-meetings
63
63
  [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
@@ -14,11 +14,17 @@ 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
- rack_span.name = "#{self.class.name}##{name}" unless request.env['action_dispatch.exception']
18
-
19
- add_rails_route(rack_span, request) if instrumentation_config[:enable_recognize_route]
20
-
21
- rack_span.set_attribute('http.target', request.filtered_path) if request.filtered_path != request.fullpath
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
23
+
24
+ attributes_to_append = {}
25
+ attributes_to_append['http.route'] = rails_route(request) if instrumentation_config[:enable_recognize_route]
26
+ attributes_to_append['http.target'] = request.filtered_path if request.filtered_path != request.fullpath
27
+ rack_span.add_attributes(attributes_to_append) unless attributes_to_append.empty?
22
28
  end
23
29
 
24
30
  super(name, request, response)
@@ -26,9 +32,10 @@ module OpenTelemetry
26
32
 
27
33
  private
28
34
 
29
- def add_rails_route(rack_span, request)
30
- ::Rails.application.routes.router.recognize(request) do |route, _params|
31
- rack_span.set_attribute('http.route', route.path.spec.to_s)
35
+ def rails_route(request)
36
+ @rails_route ||= ::Rails.application.routes.router.recognize(request) do |route, _params|
37
+ return route.path.spec.to_s
38
+ # Rails will match on the first route - see https://guides.rubyonrails.org/routing.html#crud-verbs-and-actions
32
39
  end
33
40
  end
34
41
 
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module ActionPack
10
- VERSION = '0.2.0'
10
+ VERSION = '0.3.0'
11
11
  end
12
12
  end
13
13
  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.2.0
4
+ version: 0.3.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-06-09 00:00:00.000000000 Z
11
+ date: 2022-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.73.0
159
+ version: 1.3.0
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: 0.73.0
166
+ version: 1.3.0
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-ruby
241
+ 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/opentelemetry-instrumentation-action_pack/v0.2.0/file.CHANGELOG.html
246
- source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/action_pack
247
- bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
248
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-action_pack/v0.2.0
245
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-action_pack/v0.3.0/file.CHANGELOG.html
246
+ source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/action_pack
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.3.0
249
249
  post_install_message:
250
250
  rdoc_options: []
251
251
  require_paths: