fix(trace): redact endpoint config errors - #91
Conversation
📝 WalkthroughEnglish
中文中文
WalkthroughTrace endpoint parsing and HTTP exporter initialization now redact sensitive URL values in configuration errors. Tests cover invalid endpoints containing credentials and API keys while preserving parse-failure context. ChangesTrace endpoint redaction
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
9c6837b to
782305b
Compare
12886ba to
960c075
Compare
960c075 to
4cc0a1a
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
telemetry/trace/trace_test.go (1)
162-193: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winTest the preserved error-chain contract.
The
%zzcases verify sanitized text only. Also asserterrors.As(err, &urlErr)reaches the underlying*url.Error; otherwise a future removal ofUnwrap()breaks callers without failing this regression test.中文
测试保留的错误链契约。
%zz用例目前只验证了脱敏后的错误文本。还应断言errors.As(err, &urlErr)能获取底层*url.Error;否则未来移除Unwrap()会破坏调用方,但该回归测试不会失败。As per path instructions, prioritize “error semantics” and cover “regression scenarios.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@telemetry/trace/trace_test.go` around lines 162 - 193, Extend TestStartHTTP_InvalidEndpointURLRedactsSensitiveConfig to verify the preserved error chain for the invalid endpoint cases: declare a *url.Error target and assert errors.As(err, &urlErr) succeeds, especially for the %zz inputs, while retaining the existing redaction and endpoint-context checks.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@telemetry/trace/trace_test.go`:
- Around line 162-193: Extend
TestStartHTTP_InvalidEndpointURLRedactsSensitiveConfig to verify the preserved
error chain for the invalid endpoint cases: declare a *url.Error target and
assert errors.As(err, &urlErr) succeeds, especially for the %zz inputs, while
retaining the existing redaction and endpoint-context checks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 50cd32fc-15e8-46ad-a3d8-86f7920429fd
📒 Files selected for processing (2)
telemetry/trace/trace.gotelemetry/trace/trace_test.go
Objective
Close a Phase2 trace configuration redaction gap by ensuring invalid telemetry endpoint errors do not expose credentials or API keys from endpoint URLs.
Changes
parseEndpointURLand the outer HTTP trace initialization error context.Error()text while preservingUnwrap()for programmatic error inspection.Validation
go test ./telemetry/tracego vet ./telemetry/tracegit diff --checkKnown Risks / Limitations
Follow-up