Repository navigation
fix(appsec): normalize sampling priority in the API Security sampler - #9953
Conversation
Overall package sizeSelf size: 8.64 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.4.0 | 127.33 kB | 447.04 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 9305790 | Docs | View more details | Give us feedback! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9953 +/- ##
========================================
Coverage 98.62% 98.63%
========================================
Files 996 996
Lines 152130 152275 +145
Branches 13173 13100 -73
========================================
+ Hits 150043 150193 +150
+ Misses 2087 2082 -5 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-09-01 14:25:42 Comparing candidate commit 9305790 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2297 metrics, 13 unstable metrics.
|
What does this PR do?
Splits the API Security sampler into a transport-agnostic core (
sampleRootSpanRequest) and a thin Node HTTP adapter (sampleRequest, signature unchanged). Same split for telemetry:reportRootSpanRequest/reportRequest.Fixes a bug found on the way:
getSpanPrioritynow coerces the priority to a number before comparing it against theext/priorityconstants.Motivation
The refactor unblocks calling the sampler from AWS Lambda, which has no
req/res, without duplicating the TTL cache, the priority guard and the standalone-billingkeepTraceinto a second path that would drift. The Lambda caller comes in a follow-up PR.APPSEC-68818
Additional Notes
Number(statusCode), since Lambda publishes it as a string. Sampling keys are unaffected and there is a test pinning that.