Skip to content

opentelemetry: set _other for unknown http methods#45222

Open
jakebennert wants to merge 3 commits into
envoyproxy:mainfrom
jakebennert:otel-other
Open

opentelemetry: set _other for unknown http methods#45222
jakebennert wants to merge 3 commits into
envoyproxy:mainfrom
jakebennert:otel-other

Conversation

@jakebennert

@jakebennert jakebennert commented May 22, 2026

Copy link
Copy Markdown

Commit Message

The OpenTelemetry semantic conventions state, for both client and server spans:


HTTP request method value SHOULD be “known” to the instrumentation. By default, this convention defines “known” methods as the ones listed in RFC9110, the PATCH method defined in RFC5789 and the QUERY method defined in httpbis-safe-method-w-body.

If the HTTP request method is not known to instrumentation, it MUST set the http.request.method attribute to _OTHER.


This PR updates Envoy's OpenTelemetry tracer to align with this standard.

Additional Description

AI was used to generate the code and tests in this PR. I have reviewed – and fully understand – the code.

It should be noted that Envoy's OTel tracer uses http.method instead of the more up-to-date http.request.method. However, I believe there is ongoing work to update these names happening in #45184.

Risk Level

Low

Testing

I've added unit tests that exercise the new code.

Docs Changes

None required

Release Notes

Added a changelog under minor_behavior_changes (area: opentelemetry).

Platform Specific Features

None

@repokitteh-read-only

Copy link
Copy Markdown

Hi @jakebennert, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #45222 was opened by jakebennert.

see: more, trace.

@jakebennert jakebennert had a problem deploying to external-contributors May 22, 2026 03:42 — with GitHub Actions Error
@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #45222 was opened by jakebennert.

see: more, trace.

@jakebennert jakebennert had a problem deploying to external-contributors May 22, 2026 03:44 — with GitHub Actions Error
@jakebennert jakebennert marked this pull request as ready for review May 22, 2026 03:53
@jakebennert jakebennert requested a review from yanavlasov as a code owner May 22, 2026 03:53
@tyxia

tyxia commented May 24, 2026

Copy link
Copy Markdown
Member

@jakebennert Thanks for your contribution

Please fix the DCO error

/wait

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/wait

Comment on lines +168 to +169
static constexpr std::array<absl::string_view, 10> KnownMethods{
"CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "QUERY", "TRACE"};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably use a constant/static hashmap for this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally had this as a hashmap, but Gemini made the case to me that a) the Envoy style guide discourages the use of static non-PoD types due to potential destruction order issues, and b) "a linear search on 10 contiguous elements in memory often beats a hash set lookup because it avoids the overhead of computing a hash and has excellent CPU cache locality". What do you think?

…er in the case of an unknown HTTP method, as defined in the OpenTelemetry semantic conventions.

Signed-off-by: Jake Bennert <jakebennert@google.com>
…ariables.

Signed-off-by: Jake Bennert <jakebennert@google.com>
Signed-off-by: Jake Bennert <jakebennert@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants