Conversation
…nciles - Add pkg/trace helpers for controller spans, log correlation, and k8s client transport tracing - Instrument DDA and DDAI reconcile phases with function-entry spans - Enable via --tracing-enabled / DD_OPERATOR_TRACING_ENABLED (default off) - Migrate profiler to dd-trace-go v2 and drop the v1 dependency
🛑 Gate Violations
ℹ️ Info🎯 Code Coverage (details) Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: c78f27d | Docs | Give us feedback! |
- Replace per-controller span wrappers with trace.StartSpan - Use dd-trace-go log correlation keys - Tag component spans with agent.component instead of the reserved component tag
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 101459672e
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com>
This reverts commit 99e595e.
Replace LoggerWithSpan with a log sink set on every span start, so child spans log their own span ID. Use the context logger in the DDA reconcile path.
…m-tracing # Conflicts: # internal/controller/datadogagent/experiment.go # internal/controller/datadogagent/revision.go
With DD_TRACE_ENABLED=false the tracer returns nil spans, which tagged reconcile logs with zero trace and span IDs.
What does this PR do?
Adds opt-in APM tracing (dd-trace-go v2) to the DDA and DDAI reconcile loops.
--tracing-enabledorDD_TRACING_ENABLED=true. Off by default.datadogagent.reconcile/datadogagentinternal.reconcile, tagged withkind,name,namespaceandreconcileID.manageExperiment,manageRevision,reconcileProfiles,manageDDADependenciesWithDDAI,createOrUpdateDDAI,updateStatusIfNeededapplyAndCleanupDependencies,reconcileComponent/Cleanup(taggedagent.component),reconcileV2Agent,cleanupExtraneousResources,updateStatusIfNeededDD_TRACE_HTTP_CLIENT_ERROR_STATUSES).ctrl.LoggerFrom(ctx)) includedd.trace_idand the current span'sdd.span_id, in dd-trace-go's trace ID format so they link to traces. Logs still written through the base logger (r.log) don't; moving them is tracked in a backlog card.managerunlessDD_SERVICEis set).Motivation
CONTP-2125. Existing metrics show total reconcile duration and error counts, but not which step inside a reconcile is slow or failing. Tracing breaks each reconcile into spans, including the Kubernetes API calls, so a slow or failed step can be found for a specific reconcile. This builds on the prototype in #2744.
Additional Notes
DD_AGENT_HOST(e.g. fromstatus.hostIP),DD_TRACE_AGENT_URL, or the APM socket at/var/run/datadog/apm.socket. The Helm chart sets none of these.DD_TRACE_ENABLED=falseis set alongside--tracing-enabled, no spans are created and logs aren't tagged with trace IDs.Audit-Idheader to the trace ID, so API calls in one reconcile share an audit ID.DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLEDis on (the default) and the ID has upper bits set. Otherwise they are 64-bit decimal, so pipelines that only parse decimal IDs still correlate.Minimum Agent Versions
Describe your test plan
pkg/tracecover spans, tags, errors, log fields, the transport, and a tracer that isn't running.TestReconcileTracingruns a DDA → DDAI reconcile and checks the span tree.datadog-operator.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel