add ability to skip endpoints for tracer and meter

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2024-05-04 19:05:07 +03:00
parent 307a08f50c
commit cc0f24e012
2 changed files with 16 additions and 3 deletions

View File

@ -24,6 +24,13 @@ var (
DefaultSummaryQuantiles = []float64{0.5, 0.9, 0.97, 0.99, 1}
// DefaultSummaryWindow is the default window for summary
DefaultSummaryWindow = 5 * time.Minute
// DefaultSkipEndpoints is the slice of endpoint that must not be metered
DefaultSkipEndpoints = []string{
"MeterService.Metrics",
"HealthService.Live",
"HealthService.Ready",
"HealthService.Version",
}
)
// Meter is an interface for collecting and instrumenting metrics

View File

@ -7,14 +7,20 @@ import (
"go.unistack.org/micro/v3/logger"
)
// DefaultTracer is the global default tracer
var DefaultTracer Tracer = NewTracer()
var (
// DefaultTracer is the global default tracer
DefaultTracer Tracer = NewTracer() //nolint:revive
// TraceIDKey is the key used for the trace id in the log call
TraceIDKey = "trace-id"
// SpanIDKey is the key used for the span id in the log call
SpanIDKey = "span-id"
// DefaultSkipEndpoints is the slice of endpoint that must not be traced
DefaultSkipEndpoints = []string{
"MeterService.Metrics",
"HealthService.Live",
"HealthService.Ready",
"HealthService.Version",
}
)
func init() {