Conversation
Add otelhttp.WithFilter to skip span creation for /healthz, /livez, and /readyz probe requests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Issue: LFXV2-1583 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughOpenTelemetry HTTP instrumentation in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR reduces OpenTelemetry trace noise by preventing span creation for Kubernetes probe endpoints on the service’s HTTP listener.
Changes:
- Wrap
http.DefaultServeMuxwithotelhttp.NewHandlerusingotelhttp.WithFilter. - Skip tracing for
/livezand/readyz(and currently also/healthz) requests.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
main.go (1)
262-267: Nice trace-noise reduction; consider centralizing probe paths.Line 263–266 hardcodes probe routes in the filter. Consider moving these paths to a shared constant/set (reused by both handler registration and filter logic) to avoid drift in future endpoint changes.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@main.go` around lines 262 - 267, The filter passed into otelhttp.NewHandler currently hardcodes probe paths ("/healthz", "/livez", "/readyz"); extract these into a shared constant or set (e.g., a slice or map named probePaths or probePathSet) and use that shared symbol in both the handler registration and the otelhttp.WithFilter func logic so the probe list is maintained in one place and cannot drift between registration and filtering; update the otelhttp.NewHandler call to reference the shared probePaths/probePathSet and ensure the same symbol is used wherever the probe endpoints are registered or checked.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@main.go`:
- Around line 262-267: The filter passed into otelhttp.NewHandler currently
hardcodes probe paths ("/healthz", "/livez", "/readyz"); extract these into a
shared constant or set (e.g., a slice or map named probePaths or probePathSet)
and use that shared symbol in both the handler registration and the
otelhttp.WithFilter func logic so the probe list is maintained in one place and
cannot drift between registration and filtering; update the otelhttp.NewHandler
call to reference the shared probePaths/probePathSet and ensure the same symbol
is used wherever the probe endpoints are registered or checked.
Address review comments from copilot-pull-request-reviewer[bot]: - main.go: remove /healthz from OTel filter; only /livez and /readyz are registered in this service (per copilot-pull-request-reviewer[bot]) Resolves 1 review thread. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Issue: LFXV2-1583 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Review Feedback AddressedCommit: 4e742f4 Changes Made
Threads Resolved1 of 1 unresolved threads addressed in this iteration. |
Summary
otelhttp.WithFiltertootelhttp.NewHandlerto skip span creation for/healthz,/livez, and/readyzKubernetes probe endpointsTest plan
go build ./...passesIssue: LFXV2-1583
🤖 Generated with Claude Code