Support DD_APM_TRACING_ENABLED=false for AI Guard traces#11885
Support DD_APM_TRACING_ENABLED=false for AI Guard traces#11885gh-worker-dd-mergequeue-cf854d[bot] merged 12 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42d77deb22
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This comment has been minimized.
This comment has been minimized.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
… rate-limit state
jandro996
left a comment
There was a problem hiding this comment.
One minor non-blocking nit inline about varargs allocation in isProductMarked.
No other issues found
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
What Does This Do
When
DD_APM_TRACING_ENABLED=false, AI Guard traces are now preserved and sentto the backend. The tracer no longer lets the sampler override the
USER_KEEPpriority that AI Guard sets via
ai_guard.keep.Concretely,
TraceCollector.setSamplingPriorityIfNecessarygains a guard: ifthe root span's propagated trace source (
_dd.p.ts) is marked forAI_GUARD(new
ProductTraceSource.AI_GUARDbit), the sampler is skipped entirely(whether that sampler is the regular priority sampler or the
AsmStandaloneSamplerrate-limiter used in ASM standalone mode) — mirroringthe existing bypass already in place for
ASM.AIGuardInternalnow setsTags.PROPAGATED_TRACE_SOURCE(_dd.p.ts) toProductTraceSource.AI_GUARDon the local root span alongsideai_guard.keep,so the trace source itself signals "do not let the sampler touch this."
The
ai_guard.eventtag is also promoted from a local string constant inAIGuardInternalto a canonical constant inTags(Tags.AI_GUARD_EVENT),alongside
ai_guard.keep. This tag is purely descriptive (marks a span asoriginating from an AI Guard evaluation) and plays no role in the
sampler-bypass logic.
Root spans for AI Guard evaluations carry:
_sampling_priority_v1:2(USER_KEEP) — set byforceKeep(SamplingMechanism.AI_GUARD)_dd.p.dm:-13(decision maker: AI Guard) — set by the same mechanism_dd.p.tsmarked with theAI_GUARDbit — set viaTags.PROPAGATED_TRACE_SOURCE, causes the sampler to be skippedai_guard.event:trueMotivation
Part of APPSEC-61460 (AI Guard without APM billing). AI Guard customers should
not require APM host billing. Unlike ASM standalone mode, AI Guard does not need
the "1 trace per minute" allowance — every AI Guard trace must go through.
Additional Notes
The
AsmStandaloneSampler(used when APM is disabled and AppSec is enabled)has a rate limiter that allows only 1 trace/minute for regular APM traces. The
new bypass ensures AI Guard traces are never dropped by this limiter, while
regular traces remain subject to it. The bypass is keyed off the propagated
trace source (
_dd.p.ts) rather than theai_guard.eventtag, so it composeswith the existing ASM bypass via
ProductTraceSource.isProductMarked(..., ASM, AI_GUARD).Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue/merge. You can also:/merge --commit-message "..."/merge -c/merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level (note: the PR still needs to be mergeable, this will only skip the pre-merge build)Jira ticket: APPSEC-68487