Documentation
¶
Index ¶
- func NewFactory() processor.Factory
- type AndConfig
- type AndSubPolicyConfig
- type Config
- type DecisionCacheCfg
- type DecisionMapping
- type DowngraderConfig
- type LatencyConfig
- type OTTLConditionConfig
- type PolicyConfig
- type PolicyType
- type ProbabilisticConfig
- type RecordDecisionFrom
- type RemoteProbabilisticConfig
- type RootSpansConfig
- type SharedPolicyConfig
- type SpanCountConfig
- type StatusCodeConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶
Types ¶
type AndConfig ¶
type AndConfig struct {
SubPolicyCfg []AndSubPolicyConfig `mapstructure:"and_sub_policy"`
}
AndConfig holds the common configuration to all and policies.
type AndSubPolicyConfig ¶
type AndSubPolicyConfig struct {
}
AndSubPolicyConfig holds the common configuration to all policies under and policy.
type Config ¶
type Config struct {
// Shards controls how many goroutines consume the data incoming to the processor, sharded by trace ID. Default = 1.
Shards int `mapstructure:"shards"`
// PolicyConfig sets the tail-based sampling policy which makes a sampling decision
// for a given trace when requested.
PolicyConfig []PolicyConfig `mapstructure:"policies"`
// TargetHeapBytes, is the optional target heap size runtime.MemStats.HeapAlloc.
// If set, the processor may adjust cache sizes dynamically in order to keep within the target.
// A good starting point to set this is about 75% of overall memory resource allocation.
TargetHeapBytes uint64 `mapstructure:"target_heap_bytes"`
// RegulateCacheDelay is the amount of time after which the processor starts regulating cache sizes based on the set TargetHeapBytes (if specified).
// It is optional and defaults to 0s.
// This can be used to avoid regulating cache sizes on an initial empty cache, as it can cause unnecessary cache size adjustments and high memory usage.
RegulateCacheDelay time.Duration `mapstructure:"regulate_cache_delay"`
// PrimaryCacheSize sets the initial and maximum size of the primary cache that holds non-low priority traces.
PrimaryCacheSize int `mapstructure:"primary_cache_size"`
// SecondaryCacheSize defaults to 10% of the primary cache size.
// It should not more than 50% of the primary cache size
SecondaryCacheSize int `mapstructure:"secondary_cache_size"`
DecisionCacheCfg `mapstructure:"decision_cache"`
// FlushOnShutdown determines whether to flush the pending/cached trace data upon shutdown.
FlushOnShutdown bool `mapstructure:"flush_on_shutdown"`
// CompressionEnabled compresses trace data in the primary and secondary caches if enabled
CompressionEnabled bool `mapstructure:"compression_enabled"`
// PreprocessBufferSize specifies the size of the chan that queues incoming trace data to be processed by the main loop.
// Default is 0, in which case an unbuffered channel is used.
PreprocessBufferSize int `mapstructure:"preprocess_buffer_size"`
}
type DecisionCacheCfg ¶
type DecisionCacheCfg 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 Config.MaxTraces.
// By default, 10x the Config.MaxTraces value will be used.
SampledCacheSize int `mapstructure:"sampled_cache_size"`
// NonSampledCacheSize specifies the size of the cache that holds the non-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 Config.MaxTraces.
// By default, 10x the Config.MaxTraces value will be used.
NonSampledCacheSize int `mapstructure:"non_sampled_cache_size"`
}
type DecisionMapping ¶
type DecisionMapping struct {
// Pattern is a Go regular expression matched against the extracted value.
Pattern string `mapstructure:"pattern"`
// Value is the value emitted when Pattern matches.
Value string `mapstructure:"value"`
}
DecisionMapping is a single regex-to-value rewrite rule used by RecordDecisionFrom.
type DowngraderConfig ¶
type DowngraderConfig struct {
DowngradeTo string `mapstructure:"downgrade_to"`
SubPolicyCfg SharedPolicyConfig `mapstructure:"sub_policy"`
}
type LatencyConfig ¶
type LatencyConfig struct {
// Lower bound in milliseconds
ThresholdMs int64 `mapstructure:"threshold_ms"`
}
LatencyConfig holds the configurable settings to create a latency filter sampling policy evaluator
type OTTLConditionConfig ¶
type OTTLConditionConfig struct {
ErrorMode ottl.ErrorMode `mapstructure:"error_mode"`
SpanConditions []string `mapstructure:"span"`
SpanEventConditions []string `mapstructure:"spanevent"`
}
OTTLConditionConfig holds the configurable setting to create a OTTL condition filter sampling policy evaluator.
type PolicyConfig ¶
type PolicyConfig struct {
// Configs for defining and policy
AndConfig AndConfig `mapstructure:"and"`
RootSpansConfig RootSpansConfig `mapstructure:"root_spans"`
DowngraderConfig DowngraderConfig `mapstructure:"downgrader"`
// RecordDecisionFrom is an optional configuration to be used
// for tracking which resources are causing Sampled/NotSampled decisions.
// For example, you may have a policy that matches from many services,
// setting RecordDecisionFrom.ResAttrKey to 'service.name' will enrich the telemetry with that info.
RecordDecisionFrom *RecordDecisionFrom `mapstructure:"record_decision_from"`
}
PolicyConfig holds the common configuration to all policies.
type PolicyType ¶
type PolicyType string
PolicyType indicates the type of sampling policy.
const ( // Probabilistic samples a given percentage of traces. Probabilistic PolicyType = "probabilistic" // And allows defining a policy, combining the other policies in one And PolicyType = "and" // Downgrader downgrades a sampled decision Downgrader PolicyType = "downgrader" // SpanCount sample traces that are have more spans per Trace than a given threshold. SpanCount PolicyType = "span_count" // RootSpans allows a sub-policy to be defined, and operates the sub-policy only on root spans with no children. RootSpans PolicyType = "root_spans" // Latency sample traces that are longer than a given threshold. Latency PolicyType = "latency" // StatusCode sample traces that have a given status code. StatusCode PolicyType = "status_code" // OTTLCondition sample traces which match user provided OpenTelemetry Transformation Language // conditions. OTTLCondition PolicyType = "ottl_condition" // Threshold retrieves the threshold from sampling.tail.threshold attribute. // It compares the threshold to the trace ID. Threshold PolicyType = "threshold" // RemoteProbabilistic fetches the sampling rate and samples traces based on the returned rate at runtime. RemoteProbabilistic PolicyType = "remote_probabilistic" )
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 `mapstructure:"hash_salt"`
// 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 `mapstructure:"sampling_percentage"`
}
ProbabilisticConfig holds the configurable settings to create a probabilistic sampling policy evaluator.
type RecordDecisionFrom ¶
type RecordDecisionFrom struct {
// ResAttrKey is the resource attribute key whose value is recorded.
ResAttrKey string `mapstructure:"res_attr_key"`
// Mappings is an optional ordered list of regex-to-value rewrites. The first mapping
// whose pattern matches the extracted value determines the emitted value. If no
// mapping matches, the original extracted value is emitted unchanged.
Mappings []DecisionMapping `mapstructure:"mappings"`
}
RecordDecisionFrom configures which resource attribute is recorded as the "decision_from" metric attribute, and optionally how its value is normalized to bound cardinality.
type RemoteProbabilisticConfig ¶
type RemoteProbabilisticConfig 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 `mapstructure:"hash_salt"`
// DefaultRate is the default rate at which traces are going to be sampled if there is an error from the specified rate getter.
// Defaults to zero, i.e.: no sample. Values greater or equal 100 are treated as "sample all traces".
DefaultRate float64 `mapstructure:"default_rate"`
// RateGetterExt is the component id of the rate getter extension to use to fetch the sampling rate at runtime.
// The extension must implement the RateGetter interface.
RateGetterExt component.ID `mapstructure:"rate_getter"`
}
RemoteProbabilisticConfig holds the configurable settings to create a remote probabilistic sampling policy evaluator.
type RootSpansConfig ¶
type RootSpansConfig struct {
SubPolicyCfg SharedPolicyConfig `mapstructure:"sub_policy"`
}
type SharedPolicyConfig ¶
type SharedPolicyConfig struct {
Name string `mapstructure:"name"`
Type PolicyType `mapstructure:"type"`
// So when people search for it, it comes up with “TRACE NOT SAMPLED” and then the sampling policy name attached as an attribute.
EmitSingleSpanForNotSampled bool `mapstructure:"emit_single_span_for_not_sampled"`
ProbabilisticConfig `mapstructure:"probabilistic"`
SpanCountConfig `mapstructure:"span_count"`
LatencyConfig `mapstructure:"latency"`
StatusCodeConfig `mapstructure:"status_code"`
OTTLConditionConfig `mapstructure:"ottl_condition"`
RemoteProbabilisticConfig `mapstructure:"remote_probabilistic"`
}
SharedPolicyConfig holds the common configuration to all policies that are used in derivative policy configurations such as the "and" policy.
type SpanCountConfig ¶
type SpanCountConfig struct {
// MinSpans is the minimum number of spans in a Trace for it to be sampled
MinSpans int32 `mapstructure:"min_spans"`
// LogSampled indicates whether to emit a log when a trace is sampled.
// It will log trace ID, services in trace, and span count.
LogSampled bool `mapstructure:"log_sampled"`
}
SpanCountConfig holds the configurable settings to create a Span Count filter sampling policy evaluator
type StatusCodeConfig ¶
type StatusCodeConfig struct {
StatusCodes []string `mapstructure:"status_codes"`
}
StatusCodeConfig holds the configurable settings to create a status code filter sampling policy evaluator.