dd-trace-js
dd-trace-js copied to clipboard
Standalone ASM priority sampler and tag propagation
What does this PR do?
Continuation of https://github.com/DataDog/dd-trace-js/pull/4291
Defines two new channels in opentracing/propagation/text_map.js in order to alter trace propagation:
dd-trace:span:injectwhich publishes the trace span context and the carrier that is going to be injected in a downstream reqdd-trace:span:extractwhich publishes the trace span context and the carrier when a span is going to be extracted from an upstream req.
When standalone ASM is enabled it:
- replaces default
PrioritySamplerwithStandaloneAsmPrioritySamplerviaDatadogTracerconstructor.StandaloneAsmPrioritySamplersearches for_dd.p.appsecin the tags in order to keep a trace, sets a 1 req/min rate limiter and disables user rules.
- when injecting a trace and if the trace doesn't contain
_dd.p.appsectag, removesx-datadog-and datadog info fromtracestate - when extracting a trace if the trace doesn't contain
_dd.p.appsectag, resets the sampling priority. - disables span stats and includes
'Datadog-Client-Computed-Stats': 'yes'header when exporting traces to the agent to pretend stats computation is made by the tracer
ST PR to enable Standalone ASM tests
Motivation
Support Standalone ASM billing
Plugin Checklist
- [ ] Unit tests.
- [ ] TypeScript definitions.
- [ ] TypeScript tests.
- [ ] API documentation.
- [ ] CircleCI jobs/workflows.
- [ ] Plugin is exported.
Additional Notes
Overall package size
Self size: 6.82 MB Deduped: 62.08 MB No deduping: 62.36 MB
Dependency sizes
| name | version | self size | total size |
|---|---|---|---|
| @datadog/native-appsec | 8.0.1 | 15.59 MB | 15.6 MB |
| @datadog/native-iast-taint-tracking | 2.1.0 | 14.91 MB | 14.92 MB |
| @datadog/pprof | 5.3.0 | 9.85 MB | 10.22 MB |
| protobufjs | 7.2.5 | 2.77 MB | 6.56 MB |
| @datadog/native-iast-rewriter | 2.3.1 | 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.8.0 | 1.21 MB | 1.21 MB |
| import-in-the-middle | 1.8.1 | 71.67 kB | 741.34 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 |
| 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 |
| 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 |
| module-details-from-path | 1.0.3 | 4.47 kB | 4.47 kB |
🤖 This report was automatically generated by heaviest-objects-in-the-universe
Benchmarks
Benchmark execution time: 2024-07-03 07:58:28
Comparing candidate commit 61f7b11672d0e08186c1c7040ba6f50a08a322e7 in PR branch igor/standalone-asm-priority-sampler-channel with baseline commit 2c1367b1ae4944030cc182c9a920e2f128cbb1a1 in branch master.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 260 metrics, 6 unstable metrics.
Codecov Report
Attention: Patch coverage is 96.87500% with 2 lines in your changes missing coverage. Please review.
Project coverage is 87.61%. Comparing base (
b1f1f85) to head (81700d0). Report is 28 commits behind head on master.
:exclamation: Current head 81700d0 differs from pull request most recent head f615a16
Please upload reports for the commit f615a16 to get more accurate results.
| Files | Patch % | Lines |
|---|---|---|
| ...s/dd-trace/src/opentracing/propagation/text_map.js | 71.42% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #4416 +/- ##
==========================================
- Coverage 92.64% 87.61% -5.04%
==========================================
Files 116 249 +133
Lines 4173 10767 +6594
Branches 33 33
==========================================
+ Hits 3866 9433 +5567
- Misses 307 1334 +1027
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.