samplingpolicy

package
v0.142.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decision

type Decision int32

Decision gives the status of sampling decision.

const (
	// Unspecified indicates that the status of the decision was not set yet.
	Unspecified Decision = iota
	// Pending indicates that the policy was not evaluated yet.
	Pending
	// Sampled is used to indicate that the decision was already taken
	// to sample the data.
	Sampled
	// NotSampled is used to indicate that the decision was already taken
	// to not sample the data.
	NotSampled
	// Dropped is used to indicate that a trace should be dropped regardless of
	// all other decisions.
	Dropped
	// Error is used to indicate that policy evaluation was not succeeded.
	Error
	// InvertSampled is used on the invert match flow and indicates to sample
	// the data.
	InvertSampled
	// InvertNotSampled is used on the invert match flow and indicates to not
	// sample the data.
	InvertNotSampled
)

type Evaluator

type Evaluator interface {
	// Evaluate looks at the trace data and returns a corresponding SamplingDecision.
	Evaluate(ctx context.Context, traceID pcommon.TraceID, trace *TraceData) (Decision, error)
}

Evaluator implements a tail-based sampling policy evaluator, which makes a sampling decision for a given trace when requested.

type Extension added in v0.137.0

type Extension interface {
	NewEvaluator(policyName string, cfg map[string]any) (Evaluator, error)
}

type TraceData

type TraceData struct {
	// SpanCount track the number of spans on the trace.
	SpanCount int64
	// ReceivedBatches stores all the batches received for the trace.
	ReceivedBatches ptrace.Traces
}

TraceData stores the sampling related trace data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL