opentelemetry-instrumentation-action_pack 0.12.1 → 0.12.3

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: f77abda0ab2a42f0d0ea4b2239bc0b649c88caded2b4e879907c857b95513176
4
- data.tar.gz: 172474ca71b375542a4ef4aed4bb4208b0aaedb32664140ae6722f1fa740ec18
3
+ metadata.gz: 4262115e2b8bb06f5aa8dee186cc073fa3998796d2ee0a5107493c752d575eb9
4
+ data.tar.gz: 40c809efb6f9a26ce5f2e5c35e9fbca63a0b8ab24ccb9b84217d138f46a42df7
5
5
  SHA512:
6
- metadata.gz: 212e68c7331287b9c1c44e00f2977206f0e17810b10d8037121642285ab2e8bfe47fae05a1d7f81b7c7a8f1b321638de13697f033b82b6c3f9904f9ba864df79
7
- data.tar.gz: 52fa0e75b2f71b3e5763c9f9f0b293d80478494e280d9c85583bc4844a36d283da1c4b75901e8097a2dc8f6dad6e866092888fad6cd30c137e82dcfd38ef7c0c
6
+ metadata.gz: '019f275b7a386e8c963a74bba5a97f7eb3ef40fe59986a89c82d2b8564548f886a5cce2ddc9e92870e1081a8835c06a8bdcc1af2de6b0be917a31742e9333c72'
7
+ data.tar.gz: 61cdabe47d151ae6ef41d64aa3cb34efd5d9ac8b93a8fa4aed59f41497ca94319f86ddd60a15e6d616476185d686f93da2ba1d181517992fec4f809ddb27c995
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-instrumentation-action_pack
2
2
 
3
+ ### v0.12.3 / 2025-06-16
4
+
5
+ * FIXED: Action_pack always assuming sdk spans
6
+
7
+ ### v0.12.2 / 2025-06-04
8
+
9
+ * FIXED: Rack span class naming
10
+
3
11
  ### v0.12.1 / 2025-05-07
4
12
 
5
13
  * FIXED: Account for `nil` routes
data/README.md CHANGED
@@ -69,7 +69,7 @@ The error object will be retained within `payload[:exception_object]`. Additiona
69
69
 
70
70
  ## Examples
71
71
 
72
- 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)
72
+ Example usage can be seen in the [`./example/trace_demonstration.rb` file](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/action_pack/example/trace_demonstration.ru)
73
73
 
74
74
  ## How can I get involved?
75
75
 
@@ -23,35 +23,9 @@ module OpenTelemetry
23
23
  # @param payload [Hash] the payload passed as a method argument
24
24
  # @return [Hash] the payload passed as a method argument
25
25
  def start(_name, _id, payload)
26
- span_name, attributes = to_span_name_and_attributes(payload)
27
-
28
26
  span = OpenTelemetry::Instrumentation::Rack.current_span
29
- span.name = span_name
30
- span.add_attributes(attributes)
31
- rescue StandardError => e
32
- OpenTelemetry.handle_error(exception: e)
33
- end
34
-
35
- # Invoked by ActiveSupport::Notifications at the end of the instrumentation block
36
- #
37
- # @param _name [String] of the event (unused)
38
- # @param _id [String] of the event (unused)
39
- # @param payload [Hash] the payload passed as a method argument
40
- # @return [Hash] the payload passed as a method argument
41
- def finish(_name, _id, payload)
42
- span = OpenTelemetry::Instrumentation::Rack.current_span
43
- span.record_exception(payload[:exception_object]) if payload[:exception_object]
44
- rescue StandardError => e
45
- OpenTelemetry.handle_error(exception: e)
46
- end
47
-
48
- private
27
+ return unless span.recording?
49
28
 
50
- # Extracts the span name and attributes from the payload
51
- #
52
- # @param payload [Hash] the payload passed from ActiveSupport::Notifications
53
- # @return [Array<String, Hash>] the span name and attributes
54
- def to_span_name_and_attributes(payload)
55
29
  request = payload[:request]
56
30
  # It seems that there are cases in Rails functional tests where it bypasses the routing system and the `action_dispatch.route_uri_pattern` header not being set.
57
31
  # Our Test suite executes the routing system so we are unable to recreate this error case.
@@ -66,12 +40,33 @@ module OpenTelemetry
66
40
  attributes[OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET] = request.filtered_path if request.filtered_path != request.fullpath
67
41
 
68
42
  if @span_naming == :semconv
69
- return ["#{request.method} #{http_route}", attributes] if http_route
70
-
71
- return ["#{request.method} /#{payload.dig(:params, :controller)}/#{payload.dig(:params, :action)}", attributes]
43
+ span.name = if http_route
44
+ "#{request.method} #{http_route}"
45
+ else
46
+ "#{request.method} /#{payload.dig(:params, :controller)}/#{payload.dig(:params, :action)}"
47
+ end
48
+ # If there is an exception we want to keep the original span name
49
+ # so it is easier to see where the request was routed to.
50
+ elsif !request.env['action_dispatch.exception']
51
+ span.name = "#{payload[:controller]}##{payload[:action]}"
72
52
  end
73
53
 
74
- ["#{payload[:controller]}##{payload[:action]}", attributes]
54
+ span.add_attributes(attributes)
55
+ rescue StandardError => e
56
+ OpenTelemetry.handle_error(exception: e)
57
+ end
58
+
59
+ # Invoked by ActiveSupport::Notifications at the end of the instrumentation block
60
+ #
61
+ # @param _name [String] of the event (unused)
62
+ # @param _id [String] of the event (unused)
63
+ # @param payload [Hash] the payload passed as a method argument
64
+ # @return [Hash] the payload passed as a method argument
65
+ def finish(_name, _id, payload)
66
+ span = OpenTelemetry::Instrumentation::Rack.current_span
67
+ span.record_exception(payload[:exception_object]) if payload[:exception_object]
68
+ rescue StandardError => e
69
+ OpenTelemetry.handle_error(exception: e)
75
70
  end
76
71
  end
77
72
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module ActionPack
10
- VERSION = '0.12.1'
10
+ VERSION = '0.12.3'
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.12.1
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-07 00:00:00.000000000 Z
11
+ date: 2025-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -75,10 +75,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
75
75
  licenses:
76
76
  - Apache-2.0
77
77
  metadata:
78
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_pack/0.12.1/file/CHANGELOG.md
78
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_pack/0.12.3/file/CHANGELOG.md
79
79
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/action_pack
80
80
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
81
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_pack/0.12.1
81
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_pack/0.12.3
82
82
  post_install_message:
83
83
  rdoc_options: []
84
84
  require_paths: