Documentation ¶
Overview ¶
Package sampling contains the interfaces and data types used to implement the various sampling policies.
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 // SecondChance is a special category that allows to make a final decision // after all batches are processed. It should be converted to Sampled or NotSampled SecondChance // NotSampled is used to indicate that the decision was already taken // to not sample the data. NotSampled // Dropped is used when data needs to be purged before the sampling policy // had a chance to evaluate it. Dropped )
type DropTraceEvaluator ¶
type DropTraceEvaluator interface { // ShouldDrop checks if trace should be dropped ShouldDrop(traceID pcommon.TraceID, trace *TraceData) bool }
DropTraceEvaluator implements a cascading policy evaluator, which checks if trace should be dropped completely before making any other operations
func NewDropTraceEvaluator ¶
func NewDropTraceEvaluator(logger *zap.Logger, cfg config.TraceRejectCfg) (DropTraceEvaluator, error)
NewDropTraceEvaluator creates a drop trace evaluator that checks if trace should be dropped
type PolicyEvaluator ¶
type PolicyEvaluator interface { // Evaluate looks at the trace data and returns a corresponding SamplingDecision. Evaluate(traceID pcommon.TraceID, trace *TraceData) Decision }
PolicyEvaluator implements a cascading policy evaluator, which makes a sampling decision for a given trace when requested.
func NewFilter ¶
func NewFilter(logger *zap.Logger, cfg *config.TraceAcceptCfg) (PolicyEvaluator, error)
NewFilter creates a policy evaluator that samples all traces with the specified criteria
func NewProbabilisticFilter ¶
func NewProbabilisticFilter(logger *zap.Logger, maxSpanRate int32) (PolicyEvaluator, error)
NewProbabilisticFilter creates a policy evaluator intended for selecting samples probabilistically
type TraceData ¶
type TraceData struct { sync.Mutex // Decisions gives the current status of the sampling decision for each policy. Decisions []Decision // FinalDecision describes the ultimate fate of the trace FinalDecision Decision // SelectedByProbabilisticFilter determines if this trace was selected by probabilistic filter SelectedByProbabilisticFilter bool // ProvisionalDecisionFilter includes the name of the filter which has selected the trace ProvisionalDecisionFilterName string // Arrival time the first span for the trace was received. ArrivalTime time.Time // Decisiontime time when sampling decision was taken. DecisionTime time.Time // SpanCount track the number of spans on the trace. SpanCount int32 // ReceivedBatches stores all the batches received for the trace. ReceivedBatches []ptrace.Traces }
TraceData stores the sampling related trace data.