feat(o11y): introduce http.request.method and span name for HTTP requests#4127
Conversation
diegomarquezp
commented
Mar 2, 2026
- feat(o11y): add http.request.method to span tracing
- test: update tests
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the observability of HTTP requests within the system by introducing detailed HTTP-specific attributes to tracing spans. It refactors the mechanism for generating span context, allowing for the inclusion of HTTP method and path template, which provides more granular and actionable insights into the performance and behavior of HTTP interactions. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces observability improvements for HTTP requests by adding the http.request.method attribute to traces and defining a more informative span name format (<HTTP_METHOD> <HTTP_PATH_TEMPLATE>). The changes are well-structured and include corresponding updates to unit and integration tests. However, I've identified a bug in SpanTracerFactory where an incorrect context is used to generate the new span name, which could lead to errors. My review includes a specific comment with a suggested fix for this issue.
| attemptSpanName = | ||
| String.format( | ||
| "%s %s", apiTracerContext.httpMethod(), apiTracerContext.httpPathTemplate()); |
There was a problem hiding this comment.
There's a bug here where the span name for HTTP requests is constructed using the apiTracerContext parameter directly, instead of the merged context variable. The context variable correctly holds the merged properties from both the factory-level and call-level contexts. Using apiTracerContext bypasses any factory-level context, which could lead to incorrect span names or a NullPointerException if httpMethod or httpPathTemplate are not present in the call-level context but are in the factory-level one.
Please use the context variable to ensure the merged context is used.
attemptSpanName =
String.format("%s %s", context.httpMethod(), context.httpPathTemplate());