dd-trace-rb icon indicating copy to clipboard operation
dd-trace-rb copied to clipboard

Add SNS/SQS trace propagation

Open marcotc opened this issue 6 months ago • 3 comments

This PR propagates tracing through AWS SNS and SQS messages.

This is disabled by default, but can enabled with one of these options:

# Through an environment variable...
DD_TRACE_AWS_PROPAGATION_ENABLED=true

# .. or programmatically
Datadog.configure do |c|
  c.tracing.instrument :aws, propagation: true
end

It's also possible to configure if the local span will become the child of a distributed parent span (with DD_TRACE_AWS_TRACE_PARENTAGE_STYLE=distributed) or if it will keep the local span parentage as usual (DD_TRACE_AWS_TRACE_PARENTAGE_STYLE=local). The default is distributed. But because the overall feature is disabled by default (DD_TRACE_AWS_PROPAGATION_ENABLED is false by default), span parentage is not affected out of the box.

Additional Notes:

This is the first step to support distributed observability across queues in APM Ruby. There is future work scheduled to support SNS and SQS batch workflows, as well as adding the same observability to the Kafka integration.

How to test the change? All changes have new tests added.

Unsure? Have a question? Request a review!

marcotc avatar Aug 12 '24 19:08 marcotc