Open msailes opened 2 years ago
Short term mitigation: Update https://aws-otel.github.io/docs/getting-started/lambda/lambda-java doc page to indicate only the 1 kind of APIGW event object is supported
Long term mitigation: actually fix the Lambda Java instrumentation code to support both types of objects.
This issue was marked stale. It will be closed in 30 days without additional activity.
Any updates on a fix here?
@arun-annamalai not yet. Any interest in submitting a PR fix?
@tylerbenson @msailes I think this issue should be fixed by this: https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11868
With this PR, existing built-in serialization/deserialization mechanism is being used for the events. But to get the benefit of this PR, /opt/otel-handler
must be used instead of /opt/otel-proxy-handler
@msailes I think, this issue should be fixed in the latest Java wrapper layer version and by using /opt/otel-handler
instead of /opt/otel-proxy-handler
. Can you verify that?
/opt/otel-handler
handles both request types. Does that have the same functionality as /opt/otel-proxy-handler
?
@msailes as far as I see, they are similar in terms of functionality. The only minor difference I can see is that when you return non APIGatewayProxyResponseEvent
typed response, TracingRequestApiGatewayWrapper
(used by /opt/otel-proxy-handler
script) wraps it inside APIGatewayProxyResponseEvent
, but TracingRequestWrapper
(used by /opt/otel-handler
script) doesn't.
@serkan-ozal the documentation at https://aws-otel.github.io/docs/getting-started/lambda/lambda-java#enable-auto-instrumentation-for-your-lambda-function seems to suggest that there is more functionality.
@msailes if you're talking about "HTTP context propagation" mentioned in the doc you shared, it is already supported by TracingRequestWrapper
impl too.
You can check the implementations here:
Fantastic, so it sounds like there is an opportunity to simplify the docs as well.
Here are a couple of the Lambda Java Event types related to APIGW. https://github.com/aws/aws-lambda-java-libs/blob/main/aws-lambda-java-events/README.md. I didnt fully follow the conversation of unification of otel lambda handlers.
- APIGatewayCustomAuthorizerEvent
- APIGatewayProxyRequestEvent
- APIGatewayProxyResponseEvent
- APIGatewayV2CustomAuthorizerEvent
- APIGatewayV2HTTPEvent
- APIGatewayV2HTTPResponse
- APIGatewayV2WebSocketEvent
- APIGatewayV2WebSocketResponse
What handler is the correct one for APIGatewayV2HTTPEvent
and APIGatewayV2HTTPResponse
? Would that be /opt/otel-handler
?
I have a Lambda function with the following signature. These APIGateway classes represent the HTTP API version of API Gateway.
public class ApiGatewayGetAllProductRequestHandler implements RequestHandler<APIGatewayV2HTTPEvent, APIGatewayV2HTTPResponse> {
This causes an error with the OTEL Layer implementation using 'AWS_LAMBDA_EXEC_WRAPPER' = '/opt/otel-proxy-handler'
My Lambda function throws and error and doesn't complete and I get the following error message:
The error comes from this line
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/f236b2d4c9a0813b2dddf3d35928c79b21beb6d5/instrumentation/aws-lambda/aws-lambda-events-2.2/library/src/main/java/io/opentelemetry/instrumentation/awslambdaevents/v2_2/TracingRequestApiGatewayWrapper.java#L39
Where the code only expects 'APIGatewayProxyRequestEvent'. Other event objects will be used by customers and should be supported by the otel-proxy-handler.