Documentation
¶
Index ¶
- Constants
- func FingerprintTags(tags map[string]string) uint64
- func GetServiceName(resource pcommon.Resource) string
- func MergeWith(this *transformations, other *transformations) *transformations
- func NewRPSSampler(ops ...Option) *rpsSampler
- func NewTransformations() *transformations
- func ParseMetricSketchExtractorConfigs(extractorConfigs []MetricSketchExtractorConfig, logger *zap.Logger) (map[string][]*MetricSketchExtractor, error)
- func ParseTransformations(logger *zap.Logger, statements []ContextStatement) (*transformations, error)
- func SplitTag(tag string) (scope string, name string)
- func ToFactory[T any]() map[string]ottl.Factory[T]
- type Aggregation
- type AggregationImpl
- func (a *AggregationImpl[T]) Add(name string, values []T) error
- func (a *AggregationImpl[T]) AggregationType() AggregationType
- func (a *AggregationImpl[T]) Buckets() []T
- func (a *AggregationImpl[T]) Count() uint64
- func (a *AggregationImpl[T]) Name() string
- func (a *AggregationImpl[T]) Tags() map[string]string
- func (a *AggregationImpl[T]) Value() []T
- type AggregationSet
- type AggregationType
- type ConfigManager
- type ConfigManagerImpl
- type ConfigUpdateCallbackFunc
- type ContextID
- type ContextStatement
- type ControlPlaneConfig
- type EventSamplingRuleType
- type ExtractMetricsProcessorConfig
- type Instruction
- type LogExtractor
- func (l LogExtractor) EvalLogConditions(ctx context.Context, transformCtx ottllog.TransformContext) (bool, error)
- func (l LogExtractor) ExtractAggregateAttributes(ctx context.Context, tCtx ottllog.TransformContext) map[string]any
- func (l LogExtractor) ExtractLineAttributes(ctx context.Context, tCtx ottllog.TransformContext) map[int64]map[string]any
- type LookupConfig
- func (lc *LookupConfig) ExecuteLogsRules(ctx context.Context, tCtx ottllog.TransformContext, record plog.LogRecord)
- func (lc *LookupConfig) ExecuteMetricsRules(ctx context.Context, tCtx ottldatapoint.TransformContext, ...)
- func (lc *LookupConfig) ExecuteSpansRules(ctx context.Context, tCtx ottlspan.TransformContext, record ptrace.Span)
- func (lc *LookupConfig) Init(logger *zap.Logger)
- type LookupKey
- type LookupRule
- type LookupTable
- type MetricAggregator
- type MetricAggregatorImpl
- type MetricExtractorConfig
- type MetricSketchExtractor
- func (s MetricSketchExtractor) EvalMetricConditions(ctx context.Context, transformCtx ottldatapoint.TransformContext) (bool, error)
- func (m MetricSketchExtractor) ExtractAggregateAttributes(ctx context.Context, tCtx ottldatapoint.TransformContext) map[string]any
- func (m MetricSketchExtractor) ExtractLineAttributes(ctx context.Context, tCtx ottldatapoint.TransformContext) map[int64]map[string]any
- type MetricSketchExtractorConfig
- type MissingDataConfig
- type MissingDataMetric
- type Option
- type PitbullProcessorConfig
- type RuleID
- type Sampler
- type SamplingConfig
- type SpanExtractor
- func (s SpanExtractor) EvalSpanConditions(ctx context.Context, transformCtx ottlspan.TransformContext) (bool, error)
- func (s SpanExtractor) ExtractAggregateAttributes(ctx context.Context, tCtx ottlspan.TransformContext) map[string]any
- func (s SpanExtractor) ExtractLineAttributes(ctx context.Context, tCtx ottlspan.TransformContext) map[int64]map[string]any
- type StaticSampler
- type StatsEnrichment
- type StatsProcessorConfig
- type SyntheticPollingConfig
- type SyntheticPollingTarget
- type Telemetry
- type TenantConfig
- type Transformations
- type Versioned
Constants ¶
const ( MetricName = "metricName" MetricType = "metricType" )
Variables ¶
This section is empty.
Functions ¶
func FingerprintTags ¶
func GetServiceName ¶
func NewRPSSampler ¶
func NewRPSSampler(ops ...Option) *rpsSampler
func NewTransformations ¶
func NewTransformations() *transformations
func ParseMetricSketchExtractorConfigs ¶ added in v0.27.12
func ParseMetricSketchExtractorConfigs(extractorConfigs []MetricSketchExtractorConfig, logger *zap.Logger) (map[string][]*MetricSketchExtractor, error)
func ParseTransformations ¶
func ParseTransformations(logger *zap.Logger, statements []ContextStatement) (*transformations, error)
Types ¶
type Aggregation ¶
type AggregationImpl ¶
func NewAggregationImpl ¶
func NewAggregationImpl[T int64 | float64](name string, buckets []T, aggregationType AggregationType, tags map[string]string) *AggregationImpl[T]
func (*AggregationImpl[T]) Add ¶
func (a *AggregationImpl[T]) Add(name string, values []T) error
func (*AggregationImpl[T]) AggregationType ¶
func (a *AggregationImpl[T]) AggregationType() AggregationType
func (*AggregationImpl[T]) Buckets ¶
func (a *AggregationImpl[T]) Buckets() []T
func (*AggregationImpl[T]) Count ¶
func (a *AggregationImpl[T]) Count() uint64
func (*AggregationImpl[T]) Name ¶
func (a *AggregationImpl[T]) Name() string
func (*AggregationImpl[T]) Tags ¶
func (a *AggregationImpl[T]) Tags() map[string]string
func (*AggregationImpl[T]) Value ¶
func (a *AggregationImpl[T]) Value() []T
type AggregationSet ¶
type AggregationSet[T int64 | float64] struct { Aggregations map[uint64]*AggregationImpl[T] StartTime int64 Interval int64 }
func NewAggregationSet ¶
func NewAggregationSet[T int64 | float64](starttime int64, interval int64) *AggregationSet[T]
func (*AggregationSet[T]) Add ¶
func (a *AggregationSet[T]) Add(logger *zap.Logger, name string, buckets []T, values []T, aggregationType AggregationType, tags map[string]string) error
func (*AggregationSet[T]) GetAggregations ¶
func (a *AggregationSet[T]) GetAggregations() map[uint64]*AggregationImpl[T]
type AggregationType ¶
type AggregationType int
const ( AggregationTypeSum AggregationType = iota AggregationTypeAvg AggregationTypeMin AggregationTypeMax )
func ParseAggregationType ¶ added in v0.21.5
func ParseAggregationType(s string) (AggregationType, error)
func (AggregationType) String ¶
func (a AggregationType) String() string
type ConfigManager ¶
type ConfigManager interface {
RegisterCallback(name string, callback ConfigUpdateCallbackFunc) int
UnregisterCallback(id int)
Run()
Stop()
}
type ConfigManagerImpl ¶
type ConfigManagerImpl struct {
// contains filtered or unexported fields
}
func NewConfigManagerImpl ¶
func NewConfigManagerImpl(logger *zap.Logger, CheckInterval time.Duration, fr filereader.FileReader) *ConfigManagerImpl
func (*ConfigManagerImpl) RegisterCallback ¶
func (c *ConfigManagerImpl) RegisterCallback(name string, callback ConfigUpdateCallbackFunc) int
func (*ConfigManagerImpl) Run ¶
func (c *ConfigManagerImpl) Run()
func (*ConfigManagerImpl) Stop ¶
func (c *ConfigManagerImpl) Stop()
func (*ConfigManagerImpl) UnregisterCallback ¶
func (c *ConfigManagerImpl) UnregisterCallback(id int)
type ConfigUpdateCallbackFunc ¶
type ConfigUpdateCallbackFunc func(config ControlPlaneConfig)
type ContextStatement ¶
type ContextStatement struct {
Context ContextID `json:"context,omitempty" yaml:"context,omitempty"`
RuleId RuleID `json:"rule_id,omitempty" yaml:"rule_id,omitempty"`
Priority int `json:"priority,omitempty" yaml:"priority,omitempty"`
Conditions []string `json:"conditions,omitempty" yaml:"conditions,omitempty"`
Statements []string `json:"statements,omitempty" yaml:"statements,omitempty"`
SamplingConfig SamplingConfig `json:"sampling_config,omitempty" yaml:"sampling_config,omitempty"`
Version int `json:"version,omitempty" yaml:"version,omitempty"`
}
type ControlPlaneConfig ¶
type ControlPlaneConfig struct {
Configs map[string]TenantConfig `json:"configs,omitempty" yaml:"configs,omitempty"`
// contains filtered or unexported fields
}
type EventSamplingRuleType ¶
type EventSamplingRuleType int
const ( EventSamplingRuleTypeUnknown EventSamplingRuleType = iota EventSamplingRuleTypeRandom EventSamplingRuleTypeRPS )
type ExtractMetricsProcessorConfig ¶
type ExtractMetricsProcessorConfig struct {
LogMetricExtractors []MetricExtractorConfig `json:"log_metric_extractors,omitempty" yaml:"log_metric_extractors,omitempty"`
SpanMetricExtractors []MetricExtractorConfig `json:"span_metric_extractors,omitempty" yaml:"span_metric_extractors,omitempty"`
MetricSketchExtractors []MetricSketchExtractorConfig `json:"metric_sketch_extractors,omitempty" yaml:"metric_sketch_extractors,omitempty"`
}
type Instruction ¶
type Instruction struct {
Statements []ContextStatement `json:"statements,omitempty" yaml:"statements,omitempty"`
}
type LogExtractor ¶
type LogExtractor struct {
Conditions []*ottl.Condition[*ottllog.TransformContext]
LineDimensions map[int64]map[string]*ottl.Statement[*ottllog.TransformContext]
AggregateDimensions map[string]*ottl.Statement[*ottllog.TransformContext]
MetricName string
RuleID string
MetricUnit string
MetricType string
MetricValue *ottl.Statement[*ottllog.TransformContext]
Direction chqpb.Direction
}
func ParseLogExtractorConfigs ¶
func ParseLogExtractorConfigs(extractorConfigs []MetricExtractorConfig, logger *zap.Logger) ([]*LogExtractor, error)
func (LogExtractor) EvalLogConditions ¶
func (l LogExtractor) EvalLogConditions(ctx context.Context, transformCtx ottllog.TransformContext) (bool, error)
func (LogExtractor) ExtractAggregateAttributes ¶ added in v0.27.9
func (l LogExtractor) ExtractAggregateAttributes(ctx context.Context, tCtx ottllog.TransformContext) map[string]any
func (LogExtractor) ExtractLineAttributes ¶ added in v0.27.10
func (l LogExtractor) ExtractLineAttributes(ctx context.Context, tCtx ottllog.TransformContext) map[int64]map[string]any
type LookupConfig ¶
type LookupConfig struct {
TableName string `json:"table_name,omitempty" yaml:"table_name,omitempty"`
LookupTable LookupTable `json:"lookup_table,omitempty" yaml:"lookup_table,omitempty"`
LogRules []*LookupRule `json:"log_rules,omitempty" yaml:"log_rules,omitempty"`
SpanRules []*LookupRule `json:"span_rules,omitempty" yaml:"span_rules,omitempty"`
MetricRules []*LookupRule `json:"metric_rules,omitempty" yaml:"metric_rules,omitempty"`
}
func (*LookupConfig) ExecuteLogsRules ¶
func (lc *LookupConfig) ExecuteLogsRules(ctx context.Context, tCtx ottllog.TransformContext, record plog.LogRecord)
ExecuteLogsRules executes the log rules for the given record
func (*LookupConfig) ExecuteMetricsRules ¶
func (lc *LookupConfig) ExecuteMetricsRules(ctx context.Context, tCtx ottldatapoint.TransformContext, handlerFunc func(tagToSet string, targetValue string))
ExecuteMetricsRules executes the metrics rules for the given record
func (*LookupConfig) ExecuteSpansRules ¶
func (lc *LookupConfig) ExecuteSpansRules(ctx context.Context, tCtx ottlspan.TransformContext, record ptrace.Span)
ExecuteSpansRules executes the span rules for the given record
func (*LookupConfig) Init ¶
func (lc *LookupConfig) Init(logger *zap.Logger)
type LookupKey ¶
type LookupKey struct {
ColumnName string `json:"column_name,omitempty" yaml:"column_name,omitempty"`
Expression string `json:"expression,omitempty" yaml:"expression,omitempty"`
// contains filtered or unexported fields
}
LookupKey represents a condition to be matched in the lookup table. So for example, go get the value of ColumnName = serviceName (derived by executing the OTTLExpression say: resource.attributes["service.name"]) = service1 Now find the record in the lookup table where serviceName = service1.
type LookupRule ¶
type LookupTable ¶
func (LookupTable) Transpose ¶
func (lt LookupTable) Transpose(conditionColumns []string) *transposedLookupTable
Transpose dynamically converts a regular LookupTable into a TransposedLookupTable using the provided condition columns
type MetricAggregator ¶
type MetricAggregator[T int64 | float64] interface { Emit(now time.Time) map[int64]*AggregationSet[T] MatchAndAdd(logger *zap.Logger, t *time.Time, buckets []T, value []T, aggregationType AggregationType, name string, metadata map[string]string, rattr pcommon.Map, iattr pcommon.Map, mattr pcommon.Map) (bool, error) }
type MetricAggregatorImpl ¶
func NewMetricAggregatorImpl ¶
func NewMetricAggregatorImpl[T int64 | float64](interval int64) *MetricAggregatorImpl[T]
func (*MetricAggregatorImpl[T]) Emit ¶
func (m *MetricAggregatorImpl[T]) Emit(now time.Time) map[int64]*AggregationSet[T]
type MetricExtractorConfig ¶
type MetricExtractorConfig struct {
RuleId string `json:"rule_id,omitempty" yaml:"rule_id,omitempty"`
Conditions []string `json:"conditions,omitempty" yaml:"conditions,omitempty"`
LineDimensions []map[string]string `json:"line_dimensions,omitempty" yaml:"line_dimensions,omitempty"`
AggregateDimensions map[string]string `json:"aggregate_dimensions,omitempty" yaml:"aggregate_dimensions,omitempty"`
MetricName string `json:"metric_name,omitempty" yaml:"metric_name,omitempty"`
MetricUnit string `json:"metric_unit,omitempty" yaml:"metric_unit,omitempty"`
MetricType string `json:"metric_type,omitempty" yaml:"metric_type,omitempty"`
MetricValue string `json:"metric_value,omitempty" yaml:"metric_value,omitempty"`
Version int `json:"version,omitempty" yaml:"version,omitempty"`
Direction int `json:"direction,omitempty" yaml:"direction,omitempty"` // 0 for UP, 1 for DOWN
}
type MetricSketchExtractor ¶ added in v0.27.12
type MetricSketchExtractor struct {
RuleID string
MetricName string
MetricType string
Conditions []*ottl.Condition[*ottldatapoint.TransformContext]
MetricUnit string
LineDimensions map[int64]map[string]*ottl.Statement[*ottldatapoint.TransformContext]
AggregateDimensions map[string]*ottl.Statement[*ottldatapoint.TransformContext]
OutputMetricName string
Direction chqpb.Direction
}
func (MetricSketchExtractor) EvalMetricConditions ¶ added in v0.28.5
func (s MetricSketchExtractor) EvalMetricConditions(ctx context.Context, transformCtx ottldatapoint.TransformContext) (bool, error)
func (MetricSketchExtractor) ExtractAggregateAttributes ¶ added in v0.27.13
func (m MetricSketchExtractor) ExtractAggregateAttributes(ctx context.Context, tCtx ottldatapoint.TransformContext) map[string]any
func (MetricSketchExtractor) ExtractLineAttributes ¶ added in v0.27.13
func (m MetricSketchExtractor) ExtractLineAttributes(ctx context.Context, tCtx ottldatapoint.TransformContext) map[int64]map[string]any
type MetricSketchExtractorConfig ¶ added in v0.27.12
type MetricSketchExtractorConfig struct {
RuleId string `json:"rule_id,omitempty" yaml:"rule_id,omitempty"`
Conditions []string `json:"conditions,omitempty" yaml:"conditions,omitempty"`
MetricName string `json:"metric_name,omitempty" yaml:"metric_name,omitempty"`
MetricType string `json:"metric_type,omitempty" yaml:"metric_type,omitempty"`
MetricUnit string `json:"metric_unit,omitempty" yaml:"metric_unit,omitempty"`
LineDimensions []map[string]string `json:"line_dimensions,omitempty" yaml:"line_dimensions,omitempty"`
AggregateDimensions map[string]string `json:"aggregate_dimensions,omitempty" yaml:"aggregate_dimensions,omitempty"`
OutputMetricName string `json:"output_metric_name,omitempty" yaml:"output_metric_name,omitempty"`
Version int `json:"version,omitempty" yaml:"version,omitempty"`
Direction int `json:"direction,omitempty" yaml:"direction,omitempty"` // 0 for UP, 1 for DOWN
}
type MissingDataConfig ¶ added in v0.12.6
type MissingDataConfig struct {
Metrics []MissingDataMetric `json:"metrics,omitempty" yaml:"metrics,omitempty"`
}
type MissingDataMetric ¶ added in v0.12.6
type Option ¶
type Option func(*rpsSampler)
func WithLogger ¶
func WithMaxKeys ¶
func WithMaxRPS ¶
type PitbullProcessorConfig ¶
type PitbullProcessorConfig struct {
LogStatements []ContextStatement `json:"log_statements,omitempty" yaml:"log_statements,omitempty"`
LogLookupConfigs []LookupConfig `json:"log_lookup_configs,omitempty" yaml:"log_lookup_configs,omitempty"`
MetricStatements []ContextStatement `json:"metric_statements,omitempty" yaml:"metric_statements,omitempty"`
MetricLookupConfigs []LookupConfig `json:"metric_lookup_configs,omitempty" yaml:"metric_lookup_configs,omitempty"`
SpanStatements []ContextStatement `json:"span_statements,omitempty" yaml:"span_statements,omitempty"`
SpanLookupConfigs []LookupConfig `json:"span_lookup_configs,omitempty" yaml:"span_lookup_configs,omitempty"`
}
type Sampler ¶
type Sampler interface {
// Start starts the sampler
Start() error
// Stop stops the sampler
Stop() error
// GetSampleRate returns the sample rate for a given key
GetSampleRate(key string) int
// GetSampleRateMulti returns the sample rate for a given key with a count
GetSampleRateMulti(key string, count int) int
}
type SamplingConfig ¶
type SpanExtractor ¶
type SpanExtractor struct {
RuleID string
Conditions []*ottl.Condition[*ottlspan.TransformContext]
LineDimensions map[int64]map[string]*ottl.Statement[*ottlspan.TransformContext]
AggregateDimensions map[string]*ottl.Statement[*ottlspan.TransformContext]
MetricName string
MetricUnit string
MetricType string
MetricValue *ottl.Statement[*ottlspan.TransformContext]
Direction chqpb.Direction
}
func ParseSpanExtractorConfigs ¶
func ParseSpanExtractorConfigs(extractorConfigs []MetricExtractorConfig, logger *zap.Logger) ([]*SpanExtractor, error)
func (SpanExtractor) EvalSpanConditions ¶
func (s SpanExtractor) EvalSpanConditions(ctx context.Context, transformCtx ottlspan.TransformContext) (bool, error)
func (SpanExtractor) ExtractAggregateAttributes ¶ added in v0.27.9
func (s SpanExtractor) ExtractAggregateAttributes(ctx context.Context, tCtx ottlspan.TransformContext) map[string]any
func (SpanExtractor) ExtractLineAttributes ¶ added in v0.27.9
func (s SpanExtractor) ExtractLineAttributes(ctx context.Context, tCtx ottlspan.TransformContext) map[int64]map[string]any
type StaticSampler ¶
type StaticSampler struct {
// contains filtered or unexported fields
}
func NewStaticSampler ¶
func NewStaticSampler(rate int) *StaticSampler
func (*StaticSampler) GetSampleRate ¶
func (s *StaticSampler) GetSampleRate(_ string) int
func (*StaticSampler) GetSampleRateMulti ¶
func (s *StaticSampler) GetSampleRateMulti(_ string, _ int) int
func (*StaticSampler) Start ¶
func (s *StaticSampler) Start() error
func (*StaticSampler) Stop ¶
func (s *StaticSampler) Stop() error
type StatsEnrichment ¶
type StatsProcessorConfig ¶
type StatsProcessorConfig struct {
LogEnrichments []StatsEnrichment `json:"log_enrichments,omitempty" yaml:"log_enrichments,omitempty"`
MetricEnrichments []StatsEnrichment `json:"metric_enrichments,omitempty" yaml:"metric_enrichments,omitempty"`
SpanEnrichments []StatsEnrichment `json:"span_enrichments,omitempty" yaml:"span_enrichments,omitempty"`
}
type SyntheticPollingConfig ¶ added in v0.22.8
type SyntheticPollingConfig struct {
Interval time.Duration `json:"interval,omitempty" yaml:"interval,omitempty"`
Timeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
Targets []SyntheticPollingTarget `json:"targets,omitempty" yaml:"targets,omitempty"`
}
type SyntheticPollingTarget ¶ added in v0.22.8
type SyntheticPollingTarget struct {
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
Method string `json:"method,omitempty" yaml:"method,omitempty"`
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
Timeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
}
type Telemetry ¶ added in v0.13.0
type Telemetry struct {
// ConditionsErrorCounter is a counter for the number of times condition evaluation errored.
ConditionsErrorCounter telemetry.DeferrableCounter[int64]
// ConditionsEvaluatedCounter is a counter for the number of times conditions were evaluated.
ConditionsEvaluatedCounter telemetry.DeferrableCounter[int64]
// ConditionsEvaluatedHistogram is a histogram for the timing of conditions evaluated.
ConditionsEvaluatedHistogram telemetry.DeferrableHistogram[int64]
// RateLimitedCounter is a counter for the number of times conditions passed, but the
// statements were not executed due to rate limiting.
RateLimitedCounter telemetry.DeferrableCounter[int64]
// StatementsErrorCounter is a counter for the number of times statement processing errored.
StatementsErrorCounter telemetry.DeferrableCounter[int64]
// StatementsExecutedHistogram is a histogram for the number of times statements were executed.
StatementsExecutedHistogram telemetry.DeferrableHistogram[int64]
// StatementsExecutedCounter is a counter for the timing of statements executed.
StatementsExecutedCounter telemetry.DeferrableCounter[int64]
}
Telemetry is a struct that holds all the telemetry metrics for the OTTL processor.
func NewTelemetry ¶ added in v0.13.0
type TenantConfig ¶ added in v0.10.3
type TenantConfig struct {
// Processor targets
Pitbulls map[string]*PitbullProcessorConfig `json:"pitbulls,omitempty" yaml:"pitbulls,omitempty"`
Stats map[string]*StatsProcessorConfig `json:"stats,omitempty" yaml:"stats,omitempty"`
ExtractMetrics map[string]*ExtractMetricsProcessorConfig `json:"extract_metrics,omitempty" yaml:"extract_metrics,omitempty"`
MissingDataConfig map[string]*MissingDataConfig `json:"missing_data_config,omitempty" yaml:"missing_data_config,omitempty"`
SyntheticPollings map[string]*SyntheticPollingConfig `json:"synthetic_pollings,omitempty" yaml:"synthetic_pollings,omitempty"`
}
type Transformations ¶
type Transformations = transformations