-
Notifications
You must be signed in to change notification settings - Fork 282
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
[question] How to instrument SQS lambdas properly? #2300
Comments
Tagging component owner(s). |
In the docs for Dynatrace we recommend calling TraceAsync only with the actual event object, not the messages: https://docs.dynatrace.com/docs/shortlink/aws-lambda-otel-dotnet#sqs-sns-in After all, there is only one Lambda invocation, so calling TraceAsync multiple times seems semantically wrong. I think what would be needed would be an additional API that creates the right spans to represent that we are now processing a message but not invoking the Lambda again. Related new issue seems to be #2244 (though the SDK defines a different message type than Lambda libraries). Otherwise I'd recommend following the OTel messaging semantic conventions yourself. https://github.com/open-telemetry/semantic-conventions/blob/main/docs/messaging/README.md |
@Oberon00 But isn't each record it's own message with it's own MessageAttributes and thus it's own traceparent and tracestate? I personally do the second approach: foreach (var message in sqsEvent.Records)
{
await AWSLambdaWrapper.TraceAsync(tracerProvider, (message, context) => HandleAsync(...), message, lambdaContext);
} I would love to know if this is wrong. |
I'm not 100% sure but won't it get the |
Component
OpenTelemetry.Instrumentation.AWSLambda
Question details
SQSEvent might contains multiple messages. How to handle them properly?
I can see that
ExtractParentContext
supportsSQSEvent.SQSMessage
input. So does it make sense to wrap each message processing, like this?Or maybe wrap both SQSEvent and SQSEvent.SQSMessage?
The text was updated successfully, but these errors were encountered: