opentelemetry-instrumentation-action_pack 0.12.2 → 0.13.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: d469bead142d9682483795b636de7c9d46fc8d410651f3409ab8e106a9d28f48
4
- data.tar.gz: 3e5fbfaa2a26ea52fa01f58077f8420e92b4a7a3561a4b6547ecbeecfcea07c7
3
+ metadata.gz: a2e35cfc783e7301603c7b5189e07c08e127cb755d1a6f77daa7988a7bb6542d
4
+ data.tar.gz: 3157efc05752b466b84d43972fa18864b40e8e7d9dab289a316d8bd21d602206
5
5
  SHA512:
6
- metadata.gz: 98b81892126505b05311b3ca67feb6e530e7543742fa36895e301312e737ed8e5804f8c840aaf8e743ac29e00cec79d81be9908313888311f958225ba7a38d65
7
- data.tar.gz: 1207dcac466eb75ba81f1b2ce75e8be3136f26d22e997fdb4acace9b84fbadba18aac959f181f29c8a2a0b091a9e9c7b5a3c2e37d86ec108080391c888bd8266
6
+ metadata.gz: 9857686cc8650d91d023e212fa85118ab40cc885d823ebd401516ab8db1216cdd47ea3b2e28199dfebb89e54268264dedf5710d9cb5afea1dc0205c41ee3f0a8
7
+ data.tar.gz: 424a3b7dd8d9a4df5aa72f6d89a4c4b4e036c0159964b37b217bd451b55b7652312853cd1244fc24a0c9dfa248befd57064765078b33cb8b45622ae7275c3fb6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-instrumentation-action_pack
2
2
 
3
+ ### v0.13.0 / 2025-08-19
4
+
5
+ * ADDED: Add `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable compatibility for Rack integration [#1594](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/1594)
6
+
7
+ ### v0.12.3 / 2025-06-16
8
+
9
+ * FIXED: Action_pack always assuming sdk spans
10
+
3
11
  ### v0.12.2 / 2025-06-04
4
12
 
5
13
  * FIXED: Rack span class naming
@@ -26,7 +34,7 @@
26
34
 
27
35
  ### v0.9.0 / 2024-01-09
28
36
 
29
- * BREAKING CHANGE: Use ActiveSupport instead of patches #703
37
+ * BREAKING CHANGE: Use ActiveSupport instead of patches #703
30
38
 
31
39
  ### v0.8.0 / 2023-11-22
32
40
 
@@ -41,32 +49,32 @@
41
49
  ### v0.7.0 / 2023-06-05
42
50
 
43
51
  * ADDED: Use Rack Middleware Helper
44
- * FIXED: Base config options
52
+ * FIXED: Base config options
45
53
 
46
54
  ### v0.6.0 / 2023-04-17
47
55
 
48
56
  * BREAKING CHANGE: Drop support for EoL Ruby 2.7
49
57
 
50
- * ADDED: Drop support for EoL Ruby 2.7
58
+ * ADDED: Drop support for EoL Ruby 2.7
51
59
 
52
60
  ### v0.5.0 / 2023-02-01
53
61
 
54
- * BREAKING CHANGE: Drop Rails 5 Support
62
+ * BREAKING CHANGE: Drop Rails 5 Support
55
63
 
56
- * ADDED: Drop Rails 5 Support
57
- * FIXED: Drop Rails dependency for ActiveSupport Instrumentation
64
+ * ADDED: Drop Rails 5 Support
65
+ * FIXED: Drop Rails dependency for ActiveSupport Instrumentation
58
66
 
59
67
  ### v0.4.1 / 2023-01-14
60
68
 
61
69
  * FIXED: String-ify code.function Span attribute
62
- * DOCS: Fix gem homepage
63
- * DOCS: More gem documentation fixes
70
+ * DOCS: Fix gem homepage
71
+ * DOCS: More gem documentation fixes
64
72
 
65
73
  ### v0.4.0 / 2022-12-06
66
74
 
67
- * BREAKING CHANGE: Remove enable_recognize_route and span_naming options
75
+ * BREAKING CHANGE: Remove enable_recognize_route and span_naming options
68
76
 
69
- * FIXED: Remove enable_recognize_route and span_naming options
77
+ * FIXED: Remove enable_recognize_route and span_naming options
70
78
 
71
79
  ### v0.3.2 / 2022-11-16
72
80
 
@@ -78,29 +86,29 @@
78
86
 
79
87
  ### v0.3.0 / 2022-10-14
80
88
 
81
- * ADDED: Name ActionPack spans with the HTTP method and route
89
+ * ADDED: Name ActionPack spans with the HTTP method and route
82
90
 
83
91
  ### v0.2.1 / 2022-10-04
84
92
 
85
- * FIXED: Ensures the correct route is add to http.route span attribute
93
+ * FIXED: Ensures the correct route is add to http.route span attribute
86
94
 
87
95
  ### v0.2.0 / 2022-06-09
88
96
 
89
97
  * Upgrading Base dependency version
90
- * FIXED: Broken test file requirements
98
+ * FIXED: Broken test file requirements
91
99
 
92
100
  ### v0.1.4 / 2022-05-02
93
101
 
94
- * FIXED: Use rails request's filtered path as http.target attribute
95
- * FIXED: RubyGems Fallback
102
+ * FIXED: Use rails request's filtered path as http.target attribute
103
+ * FIXED: RubyGems Fallback
96
104
 
97
105
  ### v0.1.3 / 2021-12-01
98
106
 
99
- * FIXED: Instrumentation of Rails 7
107
+ * FIXED: Instrumentation of Rails 7
100
108
 
101
109
  ### v0.1.2 / 2021-10-06
102
110
 
103
- * FIXED: Prevent high cardinality rack span name as a default
111
+ * FIXED: Prevent high cardinality rack span name as a default
104
112
 
105
113
  ### v0.1.1 / 2021-09-29
106
114
 
data/README.md CHANGED
@@ -89,3 +89,21 @@ The `opentelemetry-instrumentation-action_pack` gem is distributed under the Apa
89
89
  [slack-channel]: https://cloud-native.slack.com/archives/C01NWKKMKMY
90
90
  [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
91
91
  [rails-home]: https://rubyonrails.org/
92
+
93
+ ## HTTP semantic convention stability
94
+
95
+ In the OpenTelemetry ecosystem, HTTP semantic conventions have now reached a stable state. However, the initial Rack instrumentation, which Action Pack relies on, was introduced before this stability was achieved, which resulted in HTTP attributes being based on an older version of the semantic conventions.
96
+
97
+ To facilitate the migration to stable semantic conventions, you can use the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable. This variable allows you to opt-in to the new stable conventions, ensuring compatibility and future-proofing your instrumentation.
98
+
99
+ Sinatra instrumentation installs Rack middleware, but the middleware version it installs depends on which `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable is set.
100
+
101
+ When setting the value for `OTEL_SEMCONV_STABILITY_OPT_IN`, you can specify which conventions you wish to adopt:
102
+
103
+ - `http` - Emits the stable HTTP and networking conventions and ceases emitting the old conventions previously emitted by the instrumentation.
104
+ - `http/dup` - Emits both the old and stable HTTP and networking conventions, enabling a phased rollout of the stable semantic conventions.
105
+ - Default behavior (in the absence of either value) is to continue emitting the old HTTP and networking conventions the instrumentation previously emitted.
106
+
107
+ During the transition from old to stable conventions, Rack instrumentation code comes in three patch versions: `dup`, `old`, and `stable`. These versions are identical except for the attributes they send. Any changes to Rack instrumentation should consider all three patches.
108
+
109
+ For additional information on migration, please refer to our [documentation](https://opentelemetry.io/docs/specs/semconv/non-normative/http-migration/).
@@ -23,6 +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 = OpenTelemetry::Instrumentation::Rack.current_span
27
+ return unless span.recording?
28
+
26
29
  request = payload[:request]
27
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.
28
31
  # Our Test suite executes the routing system so we are unable to recreate this error case.
@@ -36,22 +39,18 @@ module OpenTelemetry
36
39
  attributes[OpenTelemetry::SemanticConventions::Trace::HTTP_ROUTE] = http_route if http_route
37
40
  attributes[OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET] = request.filtered_path if request.filtered_path != request.fullpath
38
41
 
39
- span = OpenTelemetry::Instrumentation::Rack.current_span
40
- span_name = if @span_naming == :semconv
41
- if http_route
42
+ if @span_naming == :semconv
43
+ span.name = if http_route
42
44
  "#{request.method} #{http_route}"
43
45
  else
44
46
  "#{request.method} /#{payload.dig(:params, :controller)}/#{payload.dig(:params, :action)}"
45
47
  end
46
- # If there is an exception we want to keep the original span name
47
- # so it is easier to see where the request was routed to.
48
- elsif request.env['action_dispatch.exception']
49
- span.name
50
- else
51
- "#{payload[:controller]}##{payload[:action]}"
52
- 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]}"
52
+ end
53
53
 
54
- span.name = span_name
55
54
  span.add_attributes(attributes)
56
55
  rescue StandardError => e
57
56
  OpenTelemetry.handle_error(exception: e)
@@ -12,9 +12,20 @@ module OpenTelemetry
12
12
  config.before_initialize do |app|
13
13
  OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.install({})
14
14
 
15
+ stability_opt_in = ENV.fetch('OTEL_SEMCONV_STABILITY_OPT_IN', '')
16
+ values = stability_opt_in.split(',').map(&:strip)
17
+
18
+ rack_middleware_args = if values.include?('http/dup')
19
+ OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.middleware_args_dup
20
+ elsif values.include?('http')
21
+ OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.middleware_args_stable
22
+ else
23
+ OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.middleware_args
24
+ end
25
+
15
26
  app.middleware.insert_before(
16
27
  0,
17
- *OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.middleware_args
28
+ *rack_middleware_args
18
29
  )
19
30
  end
20
31
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module ActionPack
10
- VERSION = '0.12.2'
10
+ VERSION = '0.13.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.12.2
4
+ version: 0.13.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: 2025-06-04 00:00:00.000000000 Z
11
+ date: 2025-08-20 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.2/file/CHANGELOG.md
78
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_pack/0.13.0/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.2
81
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_pack/0.13.0
82
82
  post_install_message:
83
83
  rdoc_options: []
84
84
  require_paths: