-
Notifications
You must be signed in to change notification settings - Fork 550
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
feat(opentelemetry-instrumentation-aws-lambda): Handle event when coming from an API Gateway, see #999 #1290
Conversation
I guess this doesn't respect the specification: https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/http/#status Because I set the status to errored when replying 400 or 500. |
Added configuration to select whether returning error codes should set the span status to failed or not: Configuration: detectApiGateway?: {
enable: true,
errorCodes?: Array<RegExp | number>
} When using When using When using Essentially, any match in the array will set the span status to error |
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
This PR was closed because it has been stale for 14 days with no activity. |
Which problem is this PR solving?
Enhancement proposal as discussed in #999
Short description of the changes
When we determine that the Lambda has been triggered from the API Gateway, we create a new span (wrapping the lambda span itself), giving it the name of the path
Given https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html (See "Output format of a Lambda function for proxy integration") we analyze the statusCode replied by the lambda, and fail the span if that error is < 200 or >= 400.
Reacting to thrown exceptions doesn't fail the span, but the exception gets recorded.
I think creating a wrapping span makes more sense than annotating the existing one. It allows a clear separation in the tracing UI between lambdas that are called through SQS, the event bridge, etc. and the ones triggered through the Gateway.