evaluators

package
v0.0.0-...-c75119f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright The OpenTelemetry Authors SPDX-License-Identifier: Apache-2.0 Modifications made by Atlassian Pty Ltd. Copyright © 2024 Atlassian US, Inc. Copyright © 2024 Atlassian Pty Ltd.

Copyright The OpenTelemetry Authors SPDX-License-Identifier: Apache-2.0 Modifications made by Atlassian Pty Ltd. Copyright © 2024 Atlassian US, Inc. Copyright © 2024 Atlassian Pty Ltd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolExpr

type BoolExpr[K any] interface {
	Eval(ctx context.Context, tCtx K) (bool, error)
}

BoolExpr is an interface that allows matching a context K against a configuration of a match.

type Decision

type Decision int32

Decision gives the status of sampling decision.

const (
	// Unspecified indicates that the policy has not been evaluated yet.
	Unspecified Decision = iota
	// Pending indicates that the final decision is still pending.
	Pending
	// Sampled is used to indicate that a final decision was made and the trace should be sent.
	Sampled
	// NotSampled is used to indicate that the decision has been taken to not sample the data, and it should be dropped.
	NotSampled
	// LowPriority indicates that this trace is unlikely to be eventually sampled.
	LowPriority
)

func StringToDecision

func StringToDecision(s string) (Decision, error)

func (Decision) String

func (d Decision) String() string

type PolicyEvaluator

type PolicyEvaluator interface {
	// Start is called when the component is first started.
	// It allows the evaluator to perform any configuration that requires the host, e.g. accessing extensions.
	Start(ctx context.Context, host component.Host) error

	// Evaluate looks at the trace data and merged metadata, and returns a corresponding SamplingDecision.
	// The cached trace data is not passed on to avoid evaluators going through the old spans.
	// The metadata should contain all relevant information about the old spans needed to make a decision.
	Evaluate(ctx context.Context, traceID pcommon.TraceID, currentTrace ptrace.Traces, mergedMetadata *tracedata.Metadata) (Decision, error)
}

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

func NewAndEvaluator

func NewAndEvaluator(
	subpolicies []PolicyEvaluator,
) PolicyEvaluator

func NewDowngrader

func NewDowngrader(downGradeTo Decision, subPolicy PolicyEvaluator) (PolicyEvaluator, error)

func NewLatency

func NewLatency(thresholdMs int64) PolicyEvaluator

NewLatency creates a policy evaluator sampling traces with a duration equal to or higher than the configured threshold

func NewOTTLConditionEvaluator

func NewOTTLConditionEvaluator(spanConditions, spanEventConditions []string, errMode ottl.ErrorMode) (PolicyEvaluator, error)

NewOTTLConditionEvaluator looks at the trace data and returns a corresponding SamplingDecision.

func NewProbabilisticSampler

func NewProbabilisticSampler(hashSalt string, samplingPercentage float64) PolicyEvaluator

NewProbabilisticSampler creates a policy evaluator that samples a percentage of traces.

func NewRemoteProbabilisticSampler

func NewRemoteProbabilisticSampler(hashSalt string, defaultRate float64, rateGetterExt component.ID) PolicyEvaluator

NewRemoteProbabilisticSampler creates a policy evaluator that samples traces based on the rate returned by the rate getter extension provided.

func NewRootSpan

func NewRootSpan(subPolicy PolicyEvaluator) PolicyEvaluator

func NewSpanCount

func NewSpanCount(minSpans int32, log *zap.Logger) PolicyEvaluator

NewSpanCount creates a policy evaluator sampling traces with more than one span per trace log may be nil

func NewStatusCodeEvaluator

func NewStatusCodeEvaluator(statusCodeString []string) (PolicyEvaluator, error)

NewStatusCodeEvaluator creates a policy evaluator that samples all traces with a given status code.

func NewThresholdEvaluator

func NewThresholdEvaluator() PolicyEvaluator

type StartFunc

type StartFunc func(context.Context, component.Host) error

StartFunc specifies the function invoked when the evaluator is being started.

func (StartFunc) Start

func (f StartFunc) Start(ctx context.Context, host component.Host) error

Jump to

Keyboard shortcuts

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