This sample project is to show a possible problem with the Spring instrumentation of SQS OtelSqsExampleControllerTest is a test that shows the problem:
- It sends an API call to /otel-sqs/example
- The controller OtelSqsExampleController calls service otelSqsExampleService that uses SqsTemplate to send a message to the queue
- The SqsMessageListenerExample is listening to the queue and
- if there is no valid SpanContext it will call sqsMessageHandler.handleMessageIfSpanContextIsNotValid
- if there is valid SpanContext and the trace id coming from traceparent attribute is the same as the trace id in the span context it will call sqsMessageHandler.handleMessageIfSpanContextIsValidAndTraceIdIsSameAsTraceParentAttribute
- if there is valid SpanContext and the trace id coming from traceparent attribute is different from the trace id in the span context it will call sqsMessageHandler.handleMessageIfSpanContextIsValidButTraceIdIsDifferentFromTraceParentAttribute
Running OtelSqsExampleControllerTest.callSqsExample_callsHandleMessageIfSpanContextIsValidButTraceIdIsDifferentFromTraceParentAttribute() shows the current state: the current span's trace id is not the same as the one used to send the message