fermentord/vendor/github.com/getsentry/sentry-go/traces_sampler.go

20 lines
562 B
Go
Raw Normal View History

package sentry
// A SamplingContext is passed to a TracesSampler to determine a sampling
// decision.
2024-06-15 13:58:47 +00:00
//
// TODO(tracing): possibly expand SamplingContext to include custom /
// user-provided data.
type SamplingContext struct {
Span *Span // The current span, always non-nil.
Parent *Span // The parent span, may be nil.
}
2024-06-15 13:58:47 +00:00
// The TracesSample type is an adapter to allow the use of ordinary
// functions as a TracesSampler.
2024-06-15 13:58:47 +00:00
type TracesSampler func(ctx SamplingContext) float64
2024-06-15 13:58:47 +00:00
func (f TracesSampler) Sample(ctx SamplingContext) float64 {
return f(ctx)
}