feat: http semconv opt in files#1547
Merged
kaylareopelle merged 14 commits intoopen-telemetry:mainfrom Jun 17, 2025
Merged
Conversation
hannahramadan
commented
May 27, 2025
| ::HTTP::Connection.prepend(Patches::Connection) | ||
| def determine_semconv | ||
| case ENV.fetch('OTEL_SEMCONV_STABILITY_OPT_IN', nil) | ||
| when 'http/dup' |
Member
Author
There was a problem hiding this comment.
http/dup takes precedence, so we check this first.
| 'server.address' => uri.host, | ||
| 'server.port' => uri.port | ||
| } | ||
| attributes['url.query'] = uri.query unless uri.query.nil? |
Member
Author
There was a problem hiding this comment.
Queries weren't previously reported and can often be nil, so we check/add this attribute separately.
|
|
||
| semconv_stability = %w[dup stable old] | ||
|
|
||
| semconv_stability.each do |mode| |
Member
Author
There was a problem hiding this comment.
This approach gives us a fresh HTTP instance on each run. Without this, a single HTTP instance receives all patches.
…amadan/opentelemetry-ruby-contrib into http_semcon_opt_in_files
kaylareopelle
approved these changes
May 30, 2025
Contributor
kaylareopelle
left a comment
There was a problem hiding this comment.
I love the simplicity of this approach, especially since we're only required to keep it for six months. Migrating to the stable semantic conventions also makes metrics integration much easier. Thank you!
xuan-cao-swi
approved these changes
Jun 3, 2025
Contributor
|
We're planning to merge this on Monday, June 16 if there are no blocking comments. |
ericmustin
approved these changes
Jun 10, 2025
This was referenced Jun 18, 2025
This was referenced Jul 10, 2025
Merged
9 tasks
This was referenced Aug 9, 2025
This was referenced Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is intended to assist in the transition from the old to new HTTP semantic conventions. Per the HTTP semantic convention stability migration spec, users should be able to set the environment variable
OTEL_SEMCONV_STABILITY_OPT_INto:httpto emit stable conventions onlyhttp/dupto emit both old and the stable conventionsThe agent is required to maintain this bridge for 6 months and may drop the environment variable in the next major version and emit only the stable HTTP and networking conventions.
While this approach introduces multiple new and similar files and tests (potentially making debugging and maintenance more difficult), the tradeoff ensures we're only patching the HTTP class once and makes the eventual cleanup of the old conventions mostly a matter of deleting files and small refactors. Another approach (also taken by Python) introduces a
StabilityModeclass that checks calls to determine which attributes to send, however this approach adds complexity of calling a method every time an attribute is added.Hopefully with the temporary nature of this work, this solution can be seen as a way to start the transition. The approach can also be easily duplicated to other HTTP libraries and support the similar DB migration.