-
Notifications
You must be signed in to change notification settings - Fork 872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add gRPC request metadata instrumentation #7011
Add gRPC request metadata instrumentation #7011
Conversation
|
...ibrary/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcAttributesExtractor.java
Outdated
Show resolved
Hide resolved
...agent/src/main/java/io/opentelemetry/javaagent/instrumentation/grpc/v1_6/GrpcSingletons.java
Outdated
Show resolved
Hide resolved
...ibrary/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcRpcAttributesGetter.java
Outdated
Show resolved
Hide resolved
...ibrary/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcRpcAttributesGetter.java
Outdated
Show resolved
Hide resolved
...ibrary/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcAttributesExtractor.java
Outdated
Show resolved
Hide resolved
...ibrary/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcAttributesExtractor.java
Outdated
Show resolved
Hide resolved
...-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java
Outdated
Show resolved
Hide resolved
...tion/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java
Outdated
Show resolved
Hide resolved
...tion/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java
Outdated
Show resolved
Hide resolved
...tion/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java
Outdated
Show resolved
Hide resolved
...tion/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java
Outdated
Show resolved
Hide resolved
...ibrary/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcAttributesExtractor.java
Outdated
Show resolved
Hide resolved
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.
Left one more minor comment, but overall it looks good to me 👍
Thanks!
...6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTelemetryBuilder.java
Outdated
Show resolved
Hide resolved
@mateuszrzeszutek |
No, it's related to our safety net mechanism (muzzle) and the latest reactor 3.5 release (which broke a few things, and removed a couple of methods). I'm currently working on a PR that fixes it. |
...brary/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/CapturedGrpcMetadataUtil.java
Outdated
Show resolved
Hide resolved
@Override | ||
public void onStart( | ||
AttributesBuilder attributes, Context parentContext, GrpcRequest grpcRequest) { | ||
// No request attributes | ||
// Request attributes captured on request end. |
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.
is it possible to capture attributes on start so they can be used for sampling?
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.
@trask Capture them only at start or at both start and end?
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.
can they be different at those two times?
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.
@trask Not sure what you mean by that
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.
sorry, I mean, if you capture the request metadata in onStart, is there a reason to capture them in onEnd also?
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.
@trask So do you think it should only be on start?
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.
if we don't know of any reason to also be on end, then let's start with "only on start"
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.
@trask
Status capture has to be on end because it doesn't exist at start.
I moved the metadata capture to start though
...ibrary/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcAttributesExtractor.java
Outdated
Show resolved
Hide resolved
...6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTelemetryBuilder.java
Outdated
Show resolved
Hide resolved
it's probably worth waiting to merge this for open-telemetry/opentelemetry-specification#2981 |
@Tavh this spec PR has been merged so you can go ahead and update the names to match 👍 |
hey @Tavh, I took a look at the latest CI failures, and it looks related to changing from onEnd to onStart. It looks a bit tricky to capture them onStart, so I'd suggest switching back to onEnd, add we can open an issue to track this, so that it doesn't need to block your PR. |
@trask Took me a while to get back to this. I reverted the changes that moved the capture to requestStart |
@Tavh one last thing and we can merge this, thx! |
ping @Tavh |
@trask changed the naming according to the spec changes |
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.
thanks @Tavh 🎉
Solves. #6991
This PR implements the request portion of the new gRPC metadata instrumentation spec:
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md#grpc-request-and-response-metadata
The changes include:
(Similar to http headers)
** Doesn't take care of the response because gRPC response is not implemented in java-instrumentation yet. (This is absolutely necessary but out of scope for this PR)
** "metadataValue" is only implemented inside GrpcRpcAttributesGetter and not in RpcAttributesGetter to avoid providing implementations for every RpcAttributesGetter in the repo as this PR only focuses on gRPC.