dd-trace-js
dd-trace-js copied to clipboard
[SVLS-4148] Inject trace context into AWS Stepfunction executions
What does this PR do?
Adds a plugin for AWS Stepfunctions that injects the datadog trace context into the input parameter of a startExecution or startSyncExecution request, if the input parameter is already a JSON object.
Question for APM-JS Did I name the Stepfunctions service correctly? I assume yes, based on the class name from the AWS SDK, but I want to be sure.
Motivation
SVLS-4148
Serverless Integrations has added the ability to trace Stepfunction executions, and we want to be able to link Stepfunction executions with upstream traces. We do so by inspecting input._datadog in the Logs to Traces Reducer.
Plugin Checklist
- [x] Unit tests.
Security
Datadog employees:
- [ ] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance
. - [x] This PR doesn't touch any of that.
Unsure? Have a question? Request a review!
Overall package size
Self size: 6.44 MB Deduped: 60.93 MB No deduping: 61.21 MB
Dependency sizes
name | version | self size | total size |
---|---|---|---|
@datadog/native-iast-taint-tracking | 1.7.0 | 16.71 MB | 16.72 MB |
@datadog/native-appsec | 7.1.1 | 14.39 MB | 14.4 MB |
@datadog/pprof | 5.2.0 | 8.84 MB | 9.21 MB |
protobufjs | 7.2.5 | 2.77 MB | 6.56 MB |
@datadog/native-iast-rewriter | 2.3.0 | 2.15 MB | 2.24 MB |
@opentelemetry/core | 1.14.0 | 872.87 kB | 1.47 MB |
@datadog/native-metrics | 2.0.0 | 898.77 kB | 1.3 MB |
@opentelemetry/api | 1.4.1 | 780.32 kB | 780.32 kB |
import-in-the-middle | 1.7.3 | 67.62 kB | 731.01 kB |
msgpack-lite | 0.1.26 | 201.16 kB | 281.59 kB |
opentracing | 0.14.7 | 194.81 kB | 194.81 kB |
semver | 7.5.4 | 93.4 kB | 123.8 kB |
pprof-format | 2.1.0 | 111.69 kB | 111.69 kB |
@datadog/sketches-js | 2.1.0 | 109.9 kB | 109.9 kB |
lodash.sortby | 4.7.0 | 75.76 kB | 75.76 kB |
lru-cache | 7.14.0 | 74.95 kB | 74.95 kB |
ipaddr.js | 2.1.0 | 60.23 kB | 60.23 kB |
ignore | 5.2.4 | 51.22 kB | 51.22 kB |
int64-buffer | 0.1.10 | 49.18 kB | 49.18 kB |
shell-quote | 1.8.1 | 44.96 kB | 44.96 kB |
istanbul-lib-coverage | 3.2.0 | 29.34 kB | 29.34 kB |
tlhunter-sorted-set | 0.1.0 | 24.94 kB | 24.94 kB |
limiter | 1.1.5 | 23.17 kB | 23.17 kB |
dc-polyfill | 0.1.4 | 23.1 kB | 23.1 kB |
retry | 0.13.1 | 18.85 kB | 18.85 kB |
node-abort-controller | 3.1.1 | 16.89 kB | 16.89 kB |
jest-docblock | 29.7.0 | 8.99 kB | 12.76 kB |
crypto-randomuuid | 1.0.0 | 11.18 kB | 11.18 kB |
path-to-regexp | 0.1.7 | 6.78 kB | 6.78 kB |
koalas | 1.0.2 | 6.47 kB | 6.47 kB |
methods | 1.1.2 | 5.29 kB | 5.29 kB |
module-details-from-path | 1.0.3 | 4.47 kB | 4.47 kB |
🤖 This report was automatically generated by heaviest-objects-in-the-universe
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 85.06%. Comparing base (
c11fcfd
) to head (546535f
). Report is 6 commits behind head on master.
:exclamation: Current head 546535f differs from pull request most recent head 21971fc. Consider uploading reports for the commit 21971fc to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #4069 +/- ##
==========================================
+ Coverage 83.11% 85.06% +1.95%
==========================================
Files 244 247 +3
Lines 10255 10950 +695
Branches 33 33
==========================================
+ Hits 8523 9315 +792
+ Misses 1732 1635 -97
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Benchmarks
Benchmark execution time: 2024-04-30 17:17:41
Comparing candidate commit 21971fcc8dcb29efed86600c892694bcf85782ff in PR branch chris.agocs/inject_trace_context_into_stepfunction_executions
with baseline commit 29f09b16a9609e420f77af2c0a01c180094d594f in branch master
.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 259 metrics, 7 unstable metrics.
It seems localstack supports the step function API - can we have a few E2E tests that check the generated spans' shape?
@jbertran , do I understand correctly that I should add a .mjs
file that creates a StepFunctions server and creates a stepfunction, and then I should add a new test similar to it('is instrumented')
in https://github.com/DataDog/dd-trace-js/blob/master/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js ?
@jbertran , do I understand correctly that I should add a
.mjs
file that creates a StepFunctions server and creates a stepfunction, and then I should add a new test similar toit('is instrumented')
in https://github.com/DataDog/dd-trace-js/blob/master/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js ?
Sorry, that's unclear on my part - what I mean by E2E tests is checking the actual spans generated, rather than checking spies.
These tests can go in packages/datadog-plugin-aws-sdk/test/stepfunctions.spec.js
. All other instrumented services already have such tests, and the localstack
container is already spun up and available, so no need to do much except replicate what's in other service tests (for example packages/datadog-plugin-aws-sdk/test/sns.spec.js
).
/merge
:steam_locomotive: MergeQueue
This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove
command.
Use /merge -c
to cancel this operation!
:steam_locomotive: MergeQueue
This pull request was merged directly.