This repository was archived by the owner on May 14, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
impl(o11y): introduce http.request.method and span name for HTTP requests #4127
Merged
diegomarquezp
merged 61 commits into
main
from
observability/tracing-attr/http-method-definition
Mar 17, 2026
Merged
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
e5b927a
feat: pass whole context to traced callables
diegomarquezp 956ae29
fix: provide getter of SpanName with suffix
diegomarquezp dfe6216
fix: concise logic in http callable factory
diegomarquezp 0ee9f4a
chore: expose newTracer method without SpanName
diegomarquezp 3cddc1b
test: adapt tests
diegomarquezp 2880286
test: move span name tests
diegomarquezp 74f97f6
fix: remove SpanName out of ApiTracerContext
diegomarquezp 418b954
fix: keep suffix in the context class
diegomarquezp 7189841
fix: revert changes in httpjson
diegomarquezp e648a63
feat: merge context in factory method
diegomarquezp 6b679d5
test: revert traced callable tests
diegomarquezp 6fbcc08
feat: SpanTracerFactory to implement newTracer with context
diegomarquezp 8b0a403
chore: rename rpcMethod to fullMethodName
diegomarquezp b45401e
test: adapt traced callable tests
diegomarquezp a49828f
test: adapt showcase it
diegomarquezp 5ecf1b0
test: expand tests of SpanTracerFactory
diegomarquezp 82cc227
chore: lint grpc module
diegomarquezp d9c4d80
chore: fix license
diegomarquezp b831ef9
feat(o11y): add http.request.method to span tracing
diegomarquezp f97b742
test: update tests
diegomarquezp ba634ea
chore: lint
diegomarquezp 6759836
fix: use merged context
diegomarquezp 401c7e8
fix: revert changes in operation callables
diegomarquezp ed58c7d
fix: use label for transport enum
diegomarquezp 342f4e3
docs: add javadocs to ApiTracerContext and LibraryMetadata
diegomarquezp 8a7dacd
fix: remove old exception message
diegomarquezp 5a845da
fix: remove unnecessary merge
diegomarquezp 00060d8
fix: revert unnecesary changes
diegomarquezp fc679c9
fix: remove suffix property
diegomarquezp 945366a
Merge remote-tracking branch 'origin/main' into observability/tracing…
diegomarquezp 726fbf1
fix: move span name logic to SpanName
diegomarquezp 6fb4ed6
fix: remove unnecessary transport check in SpanName
diegomarquezp f5cf4bf
chore: remove unnecessary comment
diegomarquezp 6711aa2
test: expand tests in ApiTracerContextTest
diegomarquezp aa2c2af
Update gax-java/gax/src/main/java/com/google/api/gax/tracing/Observab…
diegomarquezp efd2841
chore: mark TracedUnaryCallable nullable properties
diegomarquezp cee771f
Merge branch 'observability/tracing-attr/rpc.method-and-rpc.system' o…
diegomarquezp f5c2381
fix: make spanName non-nullable in traced callables
diegomarquezp 4ef3b31
Merge branch 'observability/tracing-attr/rpc.method-and-rpc.system' i…
diegomarquezp 3cb2149
chore: format
diegomarquezp 68f8d43
fix: rpc.method only in grpc
diegomarquezp 97d1aac
fix: rpc.method only in grpc
diegomarquezp 1b47eb9
fix: move OperationType to ApiTracerContext
diegomarquezp ea86930
Merge remote-tracking branch 'origin/main' into observability/tracing…
diegomarquezp e771036
Merge branch 'observability/tracing-attr/rpc.method-and-rpc.system' i…
diegomarquezp ac77f0a
Merge remote-tracking branch 'origin/main' into observability/tracing…
diegomarquezp 2817210
test: adapt tests in gax-httpjson
diegomarquezp 6c15fbd
test: adapt tests in gax-httpjson
diegomarquezp 62f017d
fix: null checks for building http span name
diegomarquezp 839469b
test: use correct assertion for http span name
diegomarquezp 33b7584
Merge remote-tracking branch 'origin/observability/tracing-attr/http-…
diegomarquezp 5e4269b
Merge branch 'main' into observability/tracing-attr/http-method-defin…
diegomarquezp 9cade37
fix: silent failure for absent http span name components
diegomarquezp 3a59f2d
Merge branch 'observability/tracing-attr/http-method-definition' of h…
diegomarquezp dc58e35
fix: default to full method name when http props not available
diegomarquezp f8989ff
chore: fix header
diegomarquezp a4a85b3
fix: remove duplicate logic
diegomarquezp 3dd4b3c
feat: introduce url.template
diegomarquezp 8f4bc45
Merge remote-tracking branch 'origin/main' into observability/tracing…
diegomarquezp db3ee56
docs: update javadoc for path property
diegomarquezp 92ebc36
Merge branch 'main' into observability/tracing-attr/http-method-defin…
blakeli0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,19 +77,22 @@ public ApiTracer newTracer(ApiTracer parent, SpanName spanName, OperationType op | |
|
|
||
| @Override | ||
| public ApiTracer newTracer(ApiTracer parent, ApiTracerContext apiTracerContext) { | ||
| ApiTracerContext context = this.apiTracerContext.merge(apiTracerContext); | ||
| ApiTracerContext mergedContext = this.apiTracerContext.merge(apiTracerContext); | ||
|
|
||
| String attemptSpanName; | ||
| if (context.transport() == ApiTracerContext.Transport.GRPC) { | ||
| attemptSpanName = context.fullMethodName(); | ||
| if (mergedContext.transport() == ApiTracerContext.Transport.GRPC) { | ||
| // gRPC Uses the full method name as span name. | ||
| attemptSpanName = mergedContext.fullMethodName(); | ||
| } else if (mergedContext.httpMethod() == null || mergedContext.httpPathTemplate() == null) { | ||
| // HTTP method name without necessary components defaults to the full method name | ||
| attemptSpanName = mergedContext.fullMethodName(); | ||
| } else { | ||
| // TODO(diegomarquezp): this is a placeholder for the HTTP span name and will be adjusted as | ||
| // the | ||
| // feature is developed. | ||
| attemptSpanName = context.fullMethodName() + "/attempt"; | ||
| // We construct the span name with HTTP method and path template. | ||
| attemptSpanName = | ||
| String.format("%s %s", mergedContext.httpMethod(), mergedContext.httpPathTemplate()); | ||
|
Comment on lines
+91
to
+92
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using String httpMethod = mergedContext.httpMethod() != null ? mergedContext.httpMethod() : "";
String httpPathTemplate =
mergedContext.httpPathTemplate() != null ? mergedContext.httpPathTemplate() : "";
attemptSpanName = (httpMethod + " " + httpPathTemplate).trim();
if (attemptSpanName.isEmpty()) {
attemptSpanName = mergedContext.fullMethodName();
}References
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added null checks instead. We must have a span name in this factory. |
||
| } | ||
|
|
||
| return new SpanTracer(traceManager, context, attemptSpanName); | ||
| return new SpanTracer(traceManager, mergedContext, attemptSpanName); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is going to be used as
url.template?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added
url.template