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 ¶
- type BoolExpr
- type Decision
- type PolicyEvaluator
- func NewAndEvaluator(subpolicies []PolicyEvaluator) PolicyEvaluator
- func NewDowngrader(downGradeTo Decision, subPolicy PolicyEvaluator) (PolicyEvaluator, error)
- func NewLatency(thresholdMs int64) PolicyEvaluator
- func NewOTTLConditionEvaluator(spanConditions, spanEventConditions []string, errMode ottl.ErrorMode) (PolicyEvaluator, error)
- func NewProbabilisticSampler(hashSalt string, samplingPercentage float64) PolicyEvaluator
- func NewRemoteProbabilisticSampler(hashSalt string, defaultRate float64, rateGetterExt component.ID) PolicyEvaluator
- func NewRootSpan(subPolicy PolicyEvaluator) PolicyEvaluator
- func NewSpanCount(minSpans int32, log *zap.Logger) PolicyEvaluator
- func NewStatusCodeEvaluator(statusCodeString []string) (PolicyEvaluator, error)
- func NewThresholdEvaluator() PolicyEvaluator
- type StartFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolExpr ¶
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 ¶
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