Skip to content

feat: add route exclusion for health check endpoints#10

Open
prathamesh-sonpatki wants to merge 3 commits intomainfrom
feat/route-exclusion
Open

feat: add route exclusion for health check endpoints#10
prathamesh-sonpatki wants to merge 3 commits intomainfrom
feat/route-exclusion

Conversation

@prathamesh-sonpatki
Copy link
Member

Summary

  • Adds configurable path exclusion so health check endpoints (/health, /metrics, /ready, etc.) don't generate trace spans
  • Three-layer matcher (exact, prefix, glob) configured via LAST9_EXCLUDED_PATHS, LAST9_EXCLUDED_PATH_PREFIXES, LAST9_EXCLUDED_PATH_PATTERNS env vars with sensible defaults
  • Wires into each OTel middleware's native filter (WithFilter/WithSkipper) — zero custom span management

Test plan

  • internal/routematcher — 22 table-driven tests (exact, prefix, glob, nil receiver, empty matcher, combined rules, no false positives)
  • config/config_test.go — env var parsing, defaults, opt-out (="" clears defaults), custom values
  • agent_test.goTestGetRouteMatcher verifies matcher is built from config after Start()
  • go build ./... and go vet ./... pass clean

🤖 Generated with Claude Code

prathamesh-sonpatki and others added 3 commits February 13, 2026 16:30
Health check endpoints (/health, /metrics, /ready, etc.) generate noise
and inflate trace volume. This adds configurable path exclusion that
leverages each OTel middleware's native filter mechanism (WithFilter/
WithSkipper), so excluded paths never create spans.

Three-layer matcher (exact, prefix, glob) configured via env vars:
- LAST9_EXCLUDED_PATHS (default: /health,/healthz,/metrics,/ready,/live,/ping)
- LAST9_EXCLUDED_PATH_PREFIXES (default: none)
- LAST9_EXCLUDED_PATH_PATTERNS (default: /*/health,/*/healthz,/*/metrics,/*/ready,/*/live,/*/ping)

Set any env var to "" to opt out of its defaults.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix fieldalignment (govet) and gofmt issues:
- Reorder struct fields for optimal GC pointer scanning
- Use named fields in TestIsEmpty struct literals
- Run gofmt for consistent formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the route exclusion feature including default excluded paths,
configuration env vars, usage examples, and matching behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nishantmodak nishantmodak self-requested a review February 16, 2026 16:09
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.

1 participant