Skip to content
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

Implement gRPC request metadata #6991

Closed
Tavh opened this issue Oct 27, 2022 · 3 comments · Fixed by #7011
Closed

Implement gRPC request metadata #6991

Tavh opened this issue Oct 27, 2022 · 3 comments · Fixed by #7011
Assignees
Labels
enhancement New feature or request

Comments

@Tavh
Copy link
Contributor

Tavh commented Oct 27, 2022

As specified in the OTel specification:
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md#grpc-request-and-response-metadata

@Tavh Tavh added the enhancement New feature or request label Oct 27, 2022
@Tavh
Copy link
Contributor Author

Tavh commented Oct 27, 2022

I would love to be assigned to this aswell

@Tavh Tavh changed the title Implement gRPC request and response metadata Implement gRPC request metadata Oct 30, 2022
@Tavh
Copy link
Contributor Author

Tavh commented Oct 30, 2022

Update:

During development I realized that gRPC response is not yet implemented in this instrumentation library.
I will focus on the request headers for this issue.

@Tavh
Copy link
Contributor Author

Tavh commented Oct 31, 2022

PR for this issue:

#7011

@mateuszrzeszutek mateuszrzeszutek linked a pull request Nov 8, 2022 that will close this issue
trask added a commit that referenced this issue Jan 18, 2023
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:

- new CommonConfig entry for desired gRPC metadata values:
'otel.instrumentation.grpc.capture-metadata.request'
(Similar to http headers)
- setting the desired metadata values in GrpcTelemetry
- new property in GrpcAttributesExtractor that holds a reference to the
GrpcRpcAttributesGetter
- new property in GrpcAttributesExtractor that stores the desired values
so it can iterate them and extract each one from the request
- inject the GrpcRpcAttributesGetter to GrpcAttributesExtractor (in
GrpcTelemetryBuilder)
- logic in GrpcRpcAttributesGetter to safely extract the gRPC metadata
value
- A new test in GrpcTest that makes sure that when a certain metadata
key name is inserted, it also ends up in the span attributes

** 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.

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant