dd-trace-rb
dd-trace-rb copied to clipboard
Add SNS/SQS trace propagation
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!
Benchmarks
Benchmark execution time: 2024-09-19 22:16:10
Comparing candidate commit 8f0bc5dc95614f321e0806196280e2ea6c8e86e7 in PR branch sns-sqs with baseline commit e32e038f60becb1421d1f34fcf448a933ef7628f in branch master.
Found 0 performance improvements and 1 performance regressions! Performance is the same for 22 metrics, 2 unstable metrics.
scenario:tracing - Propagation - Trace Context
- 🟥
throughput[-3770.823op/s; -3644.676op/s] or [-9.885%; -9.554%]
This one seems to be a bit more "flaky-like" than the others -- opened https://github.com/DataDog/dd-trace-rb/pull/3928 to hopefully improve it.
Codecov Report
Attention: Patch coverage is 99.09910% with 3 lines in your changes missing coverage. Please review.
Project coverage is 97.79%. Comparing base (
e32e038) to head (8f0bc5d). Report is 71 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| lib/datadog/tracing/contrib/aws/service/base.rb | 87.50% | 2 Missing :warning: |
| lib/datadog/tracing/contrib/aws/service/sqs.rb | 87.50% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #3842 +/- ##
========================================
Coverage 97.79% 97.79%
========================================
Files 1285 1288 +3
Lines 77028 77352 +324
Branches 3805 3824 +19
========================================
+ Hits 75329 75647 +318
- Misses 1699 1705 +6
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.