feat(contrib/mark3labs/mcp-go): support redacting tool output in LLMObs traces#4945
Conversation
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: e52108e | Docs | Datadog PR Page | Give us feedback! |
BenchmarksBenchmark execution time: 2026-07-01 16:47:32 Comparing candidate commit e52108e in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 321 metrics, 2 unstable metrics, 1 flaky benchmarks without significant changes.
|
4304847 to
d0520e7
Compare
3eb1396 to
d5512ab
Compare
d5512ab to
7a388f0
Compare
d0520e7 to
685d0fd
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a388f0236
ℹ️ 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".
| // | ||
| // The result.IsError flag is still honored for span error status — only | ||
| // the output content is redacted. | ||
| RedactToolOutput bool |
There was a problem hiding this comment.
Document the new tracer customization
This adds a public TracingConfig option that changes what LLMObs records for MCP tool calls, but the commit does not update any docs for users to discover or apply it. The root AGENTS.md says CONTRIBUTING.md should be updated for significant features that introduce a new way of interacting with or customizing the tracer, so please document this new redaction knob (or explain why it is intentionally exempt).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The full intent-capture and redaction feature set in this stack (#4939–#4945) is documented in each TracingConfig field's GoDoc rather than CONTRIBUTING.md, consistent with how the contrib's existing Hooks and IntentCaptureEnabled options are documented today. CONTRIBUTING.md currently has no MCP section to extend; adding one for this knob alone would be inconsistent with the rest of the stack.
685d0fd to
7e486c3
Compare
7a388f0 to
077eda1
Compare
7e486c3 to
7a44561
Compare
077eda1 to
3ee0d24
Compare
| IntentCaptureEnabledFunc func(ctx context.Context) bool | ||
| // RedactToolOutput replaces the tool result body sent to LLMObs with a | ||
| // fixed "[REDACTED]" string. Use this when downstream access controls | ||
| // (e.g. org2-dac) forbid forwarding tool output to LLMObs traces. |
There was a problem hiding this comment.
If this is a public repo, maybe not use internal jargon like org2-dac? something non-internal like "data access control policies"?
There was a problem hiding this comment.
Good catch — replaced org2-dac with "data access control policies" in 78a7680b8faec88a108b3fcde8dcf36157829300.
7a44561 to
f97103f
Compare
3ee0d24 to
e071f3a
Compare
d5629ec to
564721c
Compare
910e0f2 to
5deafee
Compare
564721c to
93b8d21
Compare
5deafee to
2e6bb68
Compare
93b8d21 to
78a7680
Compare
2e6bb68 to
9036f6d
Compare
9036f6d to
952cf50
Compare
78a7680 to
608922c
Compare
…bs traces Add RedactToolOutput bool to TracingConfig. When set, the tool result body sent to LLMObs is replaced with '[REDACTED]'; the result.IsError flag is still honored for span error status. This is needed when downstream access controls (e.g. org2-dac in the internal dd-source copy) forbid forwarding tool output to LLMObs traces. Generalizes the hardcoded redaction in internal dd-source PR #429591 into a configuration option so the original always-on behavior remains the default for external users.
608922c to
e52108e
Compare
952cf50 to
2e459f6
Compare
|
/stack merge |
|
View all feedbacks in Devflow UI.
Progress updates will be sent here directly. If you need support, contact us on Slack #devflow!
The expected merge time in If you need support, contact us on Slack #devflow!
The expected merge time in If you need support, contact us on Slack #devflow!
The expected merge time in If you need support, contact us on Slack #devflow!
The expected merge time in If you need support, contact us on Slack #devflow!
The expected merge time in If you need support, contact us on Slack #devflow!
PR can't be merged according to github policy If you need support, contact us on Slack #devflow with those details!
The following PRs won't be merged. The current stack is:
To get help about command usage, write If you need support, contact us on Slack #devflow with those details! |
|
/stack merge |
|
View all feedbacks in Devflow UI.
Progress updates will be sent here directly. If you need support, contact us on Slack #devflow!
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings. If you need support, contact us on Slack #devflow!
devflow unqueued this merge request: It did not become mergeable within the expected time If you need support, contact us on Slack #devflow!
The following PRs won't be merged. The current stack is:
To get help about command usage, write If you need support, contact us on Slack #devflow with those details! |
|
/stack merge |
|
View all feedbacks in Devflow UI.
Progress updates will be sent here directly.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
The expected merge time in
The expected merge time in
The expected merge time in
The expected merge time in
This stack was merged successfully. |

This PR stack ports functionality added in the clone of this contrib in dd-source back to dd-trace-go.
Summary
Add
RedactToolOutput booltoTracingConfig. When set, the tool result body sent to LLMObs is replaced with"[REDACTED]"; theresult.IsErrorflag is still honored for span error status.This is needed when downstream access controls (e.g. org2-dac in the internal dd-source copy) forbid forwarding tool output to LLMObs traces — partner teams need to see how their tools are being used in the MCP server, but not what those tools returned.
Implements the functionality of PR #429591, which hardcoded the substitution to
"[REDACTED]"in the middleware. Here it's a configuration option so the original always-on behavior remains the default for external users.Test plan
TestRedactToolOutput— success case: output is exactly"[REDACTED]"and the actual result body does not leak into span metadata.TestRedactToolOutputStillReportsIsError—mcp.NewToolResultErrorwith redaction enabled still setserror.messageon the span; the error detail string does not appear in the output annotation.Stacked on #4944.