You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add route exclusion for health check endpoints (#27)
* feat: add route exclusion to skip tracing health check endpoints
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: resolve lint errors in routematcher tests
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>
* docs: add route exclusion section to README
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>
* fix(config): reorder Config struct fields to satisfy fieldalignment lint
Move SampleRate and SamplerRatio (float64, non-pointer) after all slice
fields so the GC scan range shrinks from 184 to 168 bytes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(instrumentation): prefer var declaration over empty slice literal
Replace `opts := []T{}` with `var opts []T` in echo, gin, and gorilla
middleware — idiomatic Go for nil-initialized slices that may stay empty.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: karthikeyangs9 <karthikeyan@last9.io>
- 🔍 **Complete observability** - Full distributed tracing + metrics across all layers (HTTP → gRPC → DB → External APIs)
@@ -907,6 +909,45 @@ func processOrder(ctx context.Context, value float64) {
907
909
}
908
910
```
909
911
912
+
## 🚫 Route Exclusion
913
+
914
+
The agent automatically skips tracing for common health check and infrastructure endpoints, reducing noise in your traces. This works across all supported frameworks (net/http, Gin, Chi, Echo, Gorilla Mux, gRPC-Gateway).
915
+
916
+
### Default Excluded Routes
917
+
918
+
Out of the box, the following paths are excluded from tracing:
# Disable all default exclusions (trace everything)
943
+
export LAST9_EXCLUDED_PATHS=""
944
+
export LAST9_EXCLUDED_PATH_PATTERNS=""
945
+
```
946
+
947
+
### How It Works
948
+
949
+
Route matching is evaluated in order: exact match (O(1) map lookup) → prefix match → glob pattern match. The first match wins. Setting an environment variable to an empty string (`""`) disables its defaults, allowing you to opt out of default exclusions.
950
+
910
951
## ⚙️ Configuration
911
952
912
953
The agent reads configuration from environment variables following OpenTelemetry standards:
@@ -919,6 +960,9 @@ The agent reads configuration from environment variables following OpenTelemetry
919
960
|`OTEL_SERVICE_VERSION`| No | - | Service version (e.g., git commit SHA) |
920
961
|`OTEL_RESOURCE_ATTRIBUTES`| No | - | Additional attributes (key=value pairs) |
921
962
|`OTEL_TRACES_SAMPLER`| No |`always_on`| Sampling strategy |
963
+
|`LAST9_EXCLUDED_PATHS`| No |`/health,/healthz,...`| Exact paths to exclude from tracing |
964
+
|`LAST9_EXCLUDED_PATH_PREFIXES`| No | - | Path prefixes to exclude from tracing |
965
+
|`LAST9_EXCLUDED_PATH_PATTERNS`| No |`/*/health,/*/healthz,...`| Glob patterns to exclude from tracing |
0 commit comments