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

Fixed AsyncServerInterceptor to be compatible with OpenTelmetry #5938

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ikhoon
Copy link
Contributor

@ikhoon ikhoon commented Oct 14, 2024

Motivation:

There was a bug in AsyncServerInterceptor where a ForwardingServerCall was not unwrapped properly via reflection. Because of that, OpenTelemetry's TracingServerCall that wraps the existing ServerCall using ForwardingServerCall was rejected by the following condition.

final AbstractServerCall<I, ?> armeriaServerCall = ServerCallUtil.findArmeriaServerCall(serverCall);
checkState(armeriaServerCall != null, "Cannot use %s with a non-Armeria gRPC server. ServerCall: %s",

Modifications:

  • Use the correct reflection API to unsafely access ForwardingServerCall.delegate().

Result:

Motivation:

There was a bug in `AsyncServerInterceptor` where a `ForwardingServerCall`
was not unwrapped properly via reflection. Because of that,
OpenTelemetry's `TracingServerCall` that wraps the existing
`ServerCall` using `ForwardingServerCall` was rejected by the following
condition.
https://github.com/line/armeria/blob/6dd5cd18dcdc32431316f272128287b2037249d3/grpc/src/main/java/com/linecorp/armeria/server/grpc/DeferredListener.java#L51-L52

Modifications:

- Use the correct reflection API to unsafely access
  `ForwardingServerCall.delegate()`.

Result:

- Fix a bug where `AsyncServerInterceptor` is incompatible with
  the OpenTelemetry gRPC agent.
- Closes line#5937
@ikhoon ikhoon added the defect label Oct 14, 2024
@ikhoon ikhoon added this to the 1.31.0 milestone Oct 14, 2024
Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

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

👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gRPC AsyncServerInterceptor throws an exception when opentelemetry-javaagent is enabled
2 participants