opentelemetry-java-instrumentation
opentelemetry-java-instrumentation copied to clipboard
Sqs span links
Goal Add span links to auto-instrumentation for SQS receive message consumer span.
Background Currently, we create a consumer span for each upstream message received by the downstream receive call. The consumer span is re-parented to the upstream span context. This leads to disconnected graphs.
Solution Conform to the convention of using span links. We will create one consumer span with the parent being the server span that called the receive operation (if one exists). And span links are added to the upstream messages.
Problems There is an issue in the spec where span links can only be added when a span is created, but we do not have the span links until after span creation for receive spans. Consequently, the instrumentor class assumes we can only get links from the REQUEST object, but for receive spans the span link data is in the RESPONSE object. I have created a new instrumentor that has a no-op start function. The span creation occurs in the end function call because we now have access to the RESPONSE object (where the span link data lives). In order to achieve this, I needed to make some fields and a class public so that we can access them in the new instrumenter.
Testing There are unit tests that test the parent and span link logic.
I am placing this is draft status so that we can get feedback, but we are not ready to merge this yet.
This PR has been labeled as stale due to lack of activity. It will be automatically closed if there is no further activity over the next 14 days.