Skip to content

feat: exclude health endpoints from tracing#48

Merged
andrest50 merged 3 commits into
mainfrom
tbramwell/LFXV2-1583-exclude-health-endpoints-tracing
May 5, 2026
Merged

feat: exclude health endpoints from tracing#48
andrest50 merged 3 commits into
mainfrom
tbramwell/LFXV2-1583-exclude-health-endpoints-tracing

Conversation

@bramwelt
Copy link
Copy Markdown
Contributor

Summary

  • Add otelhttp.WithFilter to otelhttp.NewHandler to skip span creation for /healthz, /livez, and /readyz Kubernetes probe endpoints
  • Reduces high-volume, low-value trace noise from liveness/readiness probes

Test plan

  • go build ./... passes

Issue: LFXV2-1583

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings April 27, 2026 20:35
@bramwelt bramwelt requested a review from a team as a code owner April 27, 2026 20:35
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 12bfdda9-b992-4ca3-a44d-89b2adbab6cd

📥 Commits

Reviewing files that changed from the base of the PR and between 369ed63 and fd4c10b.

📒 Files selected for processing (1)
  • cmd/http.go

Walkthrough

The OpenTelemetry HTTP instrumentation wrapper in the query-service now applies a request filter to exclude the generated Livez and Readyz endpoints from tracing and metrics collection; other middleware and server behavior remain unchanged.

Changes

Cohort / File(s) Summary
OpenTelemetry HTTP Filter Configuration
cmd/http.go
Configure otelhttp.NewHandler with otelhttp.WithFilter to return false for requests whose path equals the generated Livez or Readyz endpoint paths, preventing those endpoints from being traced/recorded by this OTel wrapper.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: excluding health endpoints from OpenTelemetry tracing, which matches the core objective of reducing trace noise from Kubernetes probe endpoints.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of adding otelhttp.WithFilter to skip span creation for health endpoints and the motivation to reduce trace noise.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tbramwell/LFXV2-1583-exclude-health-endpoints-tracing

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces OpenTelemetry trace noise by preventing instrumentation from creating spans for Kubernetes probe endpoints on the query service HTTP server.

Changes:

  • Adds an otelhttp.WithFilter to the server’s otelhttp.NewHandler wrapper.
  • Excludes requests to /healthz, /livez, and /readyz from tracing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/http.go Outdated
Address review comments from copilot-pull-request-reviewer[bot]:

- cmd/http.go: use generated path helpers LivezQuerySvcPath() and
  ReadyzQuerySvcPath() instead of hard-coded strings; remove /healthz
  which has no mounted route 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>
@bramwelt
Copy link
Copy Markdown
Contributor Author

Review Feedback Addressed

Commit: fd4c10b

Changes Made

  • cmd/http.go:82: Replaced hard-coded /healthz, /livez, /readyz strings with generated path helpers querysvcsvr.LivezQuerySvcPath() and querysvcsvr.ReadyzQuerySvcPath(); removed /healthz which has no mounted route in this service (per copilot-pull-request-reviewer[bot])

Threads Resolved

1 of 1 unresolved threads addressed in this iteration.

Copilot AI review requested due to automatic review settings May 5, 2026 19:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/http.go
Comment on lines +79 to +82
handler = otelhttp.NewHandler(handler, "query-service",
otelhttp.WithFilter(func(r *http.Request) bool {
p := r.URL.Path
return p != querysvcsvr.LivezQuerySvcPath() && p != querysvcsvr.ReadyzQuerySvcPath()
@andrest50 andrest50 merged commit 43b083b into main May 5, 2026
13 checks passed
@andrest50 andrest50 deleted the tbramwell/LFXV2-1583-exclude-health-endpoints-tracing branch May 5, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants