feat: add route exclusion for health check endpoints#10
Open
prathamesh-sonpatki wants to merge 3 commits intomainfrom
Open
feat: add route exclusion for health check endpoints#10prathamesh-sonpatki wants to merge 3 commits intomainfrom
prathamesh-sonpatki wants to merge 3 commits intomainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/health,/metrics,/ready, etc.) don't generate trace spansLAST9_EXCLUDED_PATHS,LAST9_EXCLUDED_PATH_PREFIXES,LAST9_EXCLUDED_PATH_PATTERNSenv vars with sensible defaultsWithFilter/WithSkipper) — zero custom span managementTest 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 valuesagent_test.go—TestGetRouteMatcherverifies matcher is built from config afterStart()go build ./...andgo vet ./...pass clean🤖 Generated with Claude Code