tail_sampling

package
v1.5.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package tail_sampling provides an otelcol.processor.tail_sampling component.

Index

Constants

This section is empty.

Variables

View Source
var DefaultArguments = Arguments{
	DecisionWait:            30 * time.Second,
	NumTraces:               50000,
	ExpectedNewTracesPerSec: 0,
}

DefaultArguments holds default settings for Arguments.

Functions

This section is empty.

Types

type AndConfig

type AndConfig struct {
	SubPolicyConfig []AndSubPolicyConfig `alloy:"and_sub_policy,block"`
}

func (AndConfig) Convert

func (andConfig AndConfig) Convert() tsp.AndCfg

type AndSubPolicyConfig

type AndSubPolicyConfig struct {
	SharedPolicyConfig SharedPolicyConfig `alloy:",squash"`
}

AndSubPolicyConfig holds the common configuration to all policies under and policy.

func (AndSubPolicyConfig) Convert

func (andSubPolicyConfig AndSubPolicyConfig) Convert() tsp.AndSubPolicyCfg

type Arguments

type Arguments struct {
	PolicyCfgs              []PolicyConfig      `alloy:"policy,block"`
	DecisionWait            time.Duration       `alloy:"decision_wait,attr,optional"`
	NumTraces               uint64              `alloy:"num_traces,attr,optional"`
	ExpectedNewTracesPerSec uint64              `alloy:"expected_new_traces_per_sec,attr,optional"`
	DecisionCache           DecisionCacheConfig `alloy:"decision_cache,attr,optional"`
	// Output configures where to send processed data. Required.
	Output *otelcol.ConsumerArguments `alloy:"output,block"`
	// DebugMetrics configures component internal metrics. Optional.
	DebugMetrics otelcolCfg.DebugMetricsArguments `alloy:"debug_metrics,block,optional"`
}

Arguments configures the otelcol.processor.tail_sampling component.

func (Arguments) Convert

func (args Arguments) Convert() (otelcomponent.Config, error)

Convert implements processor.Arguments.

func (Arguments) DebugMetricsConfig added in v1.2.0

func (args Arguments) DebugMetricsConfig() otelcolCfg.DebugMetricsArguments

DebugMetricsConfig implements processor.Arguments.

func (Arguments) Exporters

func (args Arguments) Exporters() map[pipeline.Signal]map[otelcomponent.ID]otelcomponent.Component

Exporters implements processor.Arguments.

func (Arguments) Extensions

func (args Arguments) Extensions() map[otelcomponent.ID]otelextension.Extension

Extensions implements processor.Arguments.

func (Arguments) NextConsumers

func (args Arguments) NextConsumers() *otelcol.ConsumerArguments

NextConsumers implements processor.Arguments.

func (*Arguments) SetToDefault

func (args *Arguments) SetToDefault()

SetToDefault implements syntax.Defaulter.

func (*Arguments) Validate

func (args *Arguments) Validate() error

Validate implements syntax.Validator.

type BooleanAttributeConfig

type BooleanAttributeConfig struct {
	// Tag that the filter is going to be matching against.
	Key string `alloy:"key,attr"`
	// Value indicate the bool value, either true or false to use when matching against attribute values.
	// BooleanAttribute Policy will apply exact value match on Value
	Value bool `alloy:"value,attr"`
	// InvertMatch indicates that values must not match against attribute values.
	// If InvertMatch is true and Values is equal to 'true', all other values will be sampled except 'true'.
	// Also, if the specified Key does not match any resource or span attributes, data will be sampled.
	InvertMatch bool `alloy:"invert_match,attr,optional"`
}

BooleanAttributeConfig holds the configurable settings to create a boolean attribute filter sampling policy evaluator.

func (BooleanAttributeConfig) Convert

func (booleanAttributeConfig BooleanAttributeConfig) Convert() tsp.BooleanAttributeCfg

type CompositeConfig

type CompositeConfig struct {
	MaxTotalSpansPerSecond int64                      `alloy:"max_total_spans_per_second,attr"`
	PolicyOrder            []string                   `alloy:"policy_order,attr"`
	SubPolicyCfg           []CompositeSubPolicyConfig `alloy:"composite_sub_policy,block,optional"`
	RateAllocation         []RateAllocationConfig     `alloy:"rate_allocation,block,optional"`
}

CompositeConfig holds the configurable settings to create a composite sampling policy evaluator.

func (CompositeConfig) Convert

func (compositeConfig CompositeConfig) Convert() tsp.CompositeCfg

type CompositeSubPolicyConfig

type CompositeSubPolicyConfig struct {
	SharedPolicyConfig SharedPolicyConfig `alloy:",squash"`

	// Configs for and policy evaluator.
	AndConfig AndConfig `alloy:"and,block,optional"`
}

CompositeSubPolicyConfig holds the common configuration to all policies under composite policy.

func (CompositeSubPolicyConfig) Convert

func (compositeSubPolicyConfig CompositeSubPolicyConfig) Convert() tsp.CompositeSubPolicyCfg

type DecisionCacheConfig added in v1.3.0

type DecisionCacheConfig struct {
	// SampledCacheSize specifies the size of the cache that holds the sampled trace IDs
	// This value will be the maximum amount of trace IDs that the cache can hold before overwriting previous IDs.
	// For effective use, this value should be at least an order of magnitude higher than Arguments.NumTraces.
	// If left as default 0, a no-op DecisionCache will be used.
	SampledCacheSize int `alloy:"sampled_cache_size,attr,optional"`
}

func (DecisionCacheConfig) Convert added in v1.3.0

func (decisionCacheConfig DecisionCacheConfig) Convert() tsp.DecisionCacheConfig

type ErrorMode

type ErrorMode string

The error mode determines whether to ignore or propagate errors with evaluating OTTL conditions.

const (
	// "ignore" ignores errors returned by conditions, logs them, and continues on to the next condition.
	ErrorModeIgnore ErrorMode = "ignore"
	// "silent" ignores errors returned by conditions, does not log them, and continues on to the next condition.
	ErrorModeSilent ErrorMode = "silent"
	// "propagate" causes the evaluation to be false and an error is returned. The data is dropped.
	ErrorModePropagate ErrorMode = "propagate"
)

func (*ErrorMode) Convert

func (e *ErrorMode) Convert() ottl.ErrorMode

Convert the Alloy type to the Otel type

func (*ErrorMode) UnmarshalText

func (e *ErrorMode) UnmarshalText(text []byte) error

func (*ErrorMode) Validate

func (e *ErrorMode) Validate() error

Validate implements syntax.Validator.

type LatencyConfig

type LatencyConfig struct {
	// ThresholdMs in milliseconds.
	ThresholdMs int64 `alloy:"threshold_ms,attr"`
	// Upper bound in milliseconds.
	UpperThresholdmsMs int64 `alloy:"upper_threshold_ms,attr,optional"`
}

LatencyConfig holds the configurable settings to create a latency filter sampling policy evaluator

func (LatencyConfig) Convert

func (latencyConfig LatencyConfig) Convert() tsp.LatencyCfg

type NumericAttributeConfig

type NumericAttributeConfig struct {
	// Tag that the filter is going to be matching against.
	Key string `alloy:"key,attr"`
	// MinValue is the minimum value of the attribute to be considered a match.
	MinValue int64 `alloy:"min_value,attr"`
	// MaxValue is the maximum value of the attribute to be considered a match.
	MaxValue int64 `alloy:"max_value,attr"`
	// InvertMatch indicates that values must not match against attribute values.
	// If InvertMatch is true and Values is equal to '123', all other values will be sampled except '123'.
	// Also, if the specified Key does not match any resource or span attributes, data will be sampled.
	InvertMatch bool `alloy:"invert_match,attr,optional"`
}

NumericAttributeConfig holds the configurable settings to create a numeric attribute filter sampling policy evaluator.

func (NumericAttributeConfig) Convert

func (numericAttributeConfig NumericAttributeConfig) Convert() tsp.NumericAttributeCfg

type OttlConditionConfig

type OttlConditionConfig struct {
	ErrorMode           ErrorMode `alloy:"error_mode,attr"`
	SpanConditions      []string  `alloy:"span,attr,optional"`
	SpanEventConditions []string  `alloy:"spanevent,attr,optional"`
}

OttlConditionConfig holds the configurable setting to create a OTTL condition filter sampling policy evaluator.

func (OttlConditionConfig) Convert

func (ottlConditionConfig OttlConditionConfig) Convert() tsp.OTTLConditionCfg

type PolicyConfig

type PolicyConfig struct {
	SharedPolicyConfig SharedPolicyConfig `alloy:",squash"`

	// Configs for defining composite policy
	CompositeConfig CompositeConfig `alloy:"composite,block,optional"`

	// Configs for defining and policy
	AndConfig AndConfig `alloy:"and,block,optional"`
}

func (PolicyConfig) Convert

func (policyConfig PolicyConfig) Convert() tsp.PolicyCfg

type ProbabilisticConfig

type ProbabilisticConfig struct {
	// HashSalt allows one to configure the hashing salts. This is important in scenarios where multiple layers of collectors
	// have different sampling rates: if they use the same salt all passing one layer may pass the other even if they have
	// different sampling rates, configuring different salts avoids that.
	HashSalt string `alloy:"hash_salt,attr,optional"`
	// SamplingPercentage is the percentage rate at which traces are going to be sampled. Defaults to zero, i.e.: no sample.
	// Values greater or equal 100 are treated as "sample all traces".
	SamplingPercentage float64 `alloy:"sampling_percentage,attr"`
}

ProbabilisticConfig holds the configurable settings to create a probabilistic sampling policy evaluator.

func (ProbabilisticConfig) Convert

func (probabilisticConfig ProbabilisticConfig) Convert() tsp.ProbabilisticCfg

type RateAllocationConfig

type RateAllocationConfig struct {
	Policy  string `alloy:"policy,attr"`
	Percent int64  `alloy:"percent,attr"`
}

RateAllocationConfig used within composite policy

func (RateAllocationConfig) Convert

func (rateAllocationConfig RateAllocationConfig) Convert() tsp.RateAllocationCfg

type RateLimitingConfig

type RateLimitingConfig struct {
	// SpansPerSecond sets the limit on the maximum nuber of spans that can be processed each second.
	SpansPerSecond int64 `alloy:"spans_per_second,attr"`
}

RateLimitingConfig holds the configurable settings to create a rate limiting sampling policy evaluator.

func (RateLimitingConfig) Convert

func (rateLimitingConfig RateLimitingConfig) Convert() tsp.RateLimitingCfg

type SharedPolicyConfig

type SharedPolicyConfig struct {
	Name                   string                 `alloy:"name,attr"`
	Type                   string                 `alloy:"type,attr"`
	LatencyConfig          LatencyConfig          `alloy:"latency,block,optional"`
	NumericAttributeConfig NumericAttributeConfig `alloy:"numeric_attribute,block,optional"`
	ProbabilisticConfig    ProbabilisticConfig    `alloy:"probabilistic,block,optional"`
	StatusCodeConfig       StatusCodeConfig       `alloy:"status_code,block,optional"`
	StringAttributeConfig  StringAttributeConfig  `alloy:"string_attribute,block,optional"`
	RateLimitingConfig     RateLimitingConfig     `alloy:"rate_limiting,block,optional"`
	SpanCountConfig        SpanCountConfig        `alloy:"span_count,block,optional"`
	BooleanAttributeConfig BooleanAttributeConfig `alloy:"boolean_attribute,block,optional"`
	OttlConditionConfig    OttlConditionConfig    `alloy:"ottl_condition,block,optional"`
	TraceStateConfig       TraceStateConfig       `alloy:"trace_state,block,optional"`
}

This cannot currently have a Convert() because tsp.sharedPolicyCfg isn't public

type SpanCountConfig

type SpanCountConfig struct {
	// Minimum number of spans in a Trace
	MinSpans int32 `alloy:"min_spans,attr"`
	MaxSpans int32 `alloy:"max_spans,attr,optional"`
}

SpanCountConfig holds the configurable settings to create a Span Count filter sampling policy sampling policy evaluator

func (SpanCountConfig) Convert

func (spanCountConfig SpanCountConfig) Convert() tsp.SpanCountCfg

type StatusCodeConfig

type StatusCodeConfig struct {
	StatusCodes []string `alloy:"status_codes,attr"`
}

StatusCodeConfig holds the configurable settings to create a status code filter sampling policy evaluator.

func (StatusCodeConfig) Convert

func (statusCodeConfig StatusCodeConfig) Convert() tsp.StatusCodeCfg

type StringAttributeConfig

type StringAttributeConfig struct {
	// Tag that the filter is going to be matching against.
	Key string `alloy:"key,attr"`
	// Values indicate the set of values or regular expressions to use when matching against attribute values.
	// StringAttribute Policy will apply exact value match on Values unless EnabledRegexMatching is true.
	Values []string `alloy:"values,attr"`
	// EnabledRegexMatching determines whether match attribute values by regexp string.
	EnabledRegexMatching bool `alloy:"enabled_regex_matching,attr,optional"`
	// CacheMaxSize is the maximum number of attribute entries of LRU Cache that stores the matched result
	// from the regular expressions defined in Values.
	// CacheMaxSize will not be used if EnabledRegexMatching is set to false.
	CacheMaxSize int `alloy:"cache_max_size,attr,optional"`
	// InvertMatch indicates that values or regular expressions must not match against attribute values.
	// If InvertMatch is true and Values is equal to 'acme', all other values will be sampled except 'acme'.
	// Also, if the specified Key does not match on any resource or span attributes, data will be sampled.
	InvertMatch bool `alloy:"invert_match,attr,optional"`
}

StringAttributeConfig holds the configurable settings to create a string attribute filter sampling policy evaluator.

func (StringAttributeConfig) Convert

func (stringAttributeConfig StringAttributeConfig) Convert() tsp.StringAttributeCfg

type TraceStateConfig

type TraceStateConfig struct {
	// Tag that the filter is going to be matching against.
	Key string `alloy:"key,attr"`
	// Values indicate the set of values to use when matching against trace_state values.
	Values []string `alloy:"values,attr"`
}

func (TraceStateConfig) Convert

func (traceStateConfig TraceStateConfig) Convert() tsp.TraceStateCfg

Jump to

Keyboard shortcuts

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