Skip to content

Commit 3337e0a

Browse files
committed
fix PROPAGATED_TRACE_SOURCE
1 parent 7127442 commit 3337e0a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dd-java-agent/appsec/src/main/java/com/datadog/appsec/gateway/GatewayBridge.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -856,11 +856,12 @@ private NoopFlow onRequestEnded(RequestContext ctx_, IGSpanInfo spanInfo) {
856856
log.info(
857857
"[APPSEC-57815] Setting ASM_KEEP=true (API Security sampled, APM tracing disabled)");
858858
traceSeg.setTagTop(Tags.ASM_KEEP, true);
859-
// Verify the tag was set and check sampling priority
859+
// Must set _dd.p.ts locally so TraceCollector respects force-keep in standalone mode
860+
// (TraceCollector.java lines 67-74 ignore force-keep without _dd.p.ts when APM disabled)
861+
traceSeg.setTagTop(Tags.PROPAGATED_TRACE_SOURCE, ProductTraceSource.ASM);
862+
// Verify the tag was set
860863
Object asmKeepAfterSet = traceSeg.getTagTop(Tags.ASM_KEEP);
861864
log.info("[APPSEC-57815] ASM_KEEP after setTagTop: {}", asmKeepAfterSet);
862-
// Note: _dd.p.ts (PROPAGATED_TRACE_SOURCE) is only set when there are actual AppSec events
863-
// (see lines below where collectedEvents is checked), not just for API Security sampling
864865
}
865866
} else {
866867
ctx.closeWafContext();

0 commit comments

Comments
 (0)