Documentation
¶
Overview ¶
Package filterprocessor implements a processor for filtering (dropping) metrics and/or spans by various properties.
Index ¶
- func DefaultDataPointFunctions() []ottl.Factory[*ottldatapoint.TransformContext]
- func DefaultDataPointFunctionsNew() []ottl.Factory[*ottldatapoint.TransformContext]deprecated
- func DefaultLogFunctions() []ottl.Factory[*ottllog.TransformContext]
- func DefaultLogFunctionsNew() []ottl.Factory[*ottllog.TransformContext]deprecated
- func DefaultMetricFunctions() []ottl.Factory[*ottlmetric.TransformContext]
- func DefaultMetricFunctionsNew() []ottl.Factory[*ottlmetric.TransformContext]deprecated
- func DefaultProfileFunctions() []ottl.Factory[*ottlprofile.TransformContext]
- func DefaultProfileFunctionsNew() []ottl.Factory[*ottlprofile.TransformContext]deprecated
- func DefaultResourceFunctions() []ottl.Factory[*ottlresource.TransformContext]
- func DefaultSpanEventFunctions() []ottl.Factory[*ottlspanevent.TransformContext]
- func DefaultSpanEventFunctionsNew() []ottl.Factory[*ottlspanevent.TransformContext]deprecated
- func DefaultSpanFunctions() []ottl.Factory[*ottlspan.TransformContext]
- func DefaultSpanFunctionsNew() []ottl.Factory[*ottlspan.TransformContext]deprecated
- func NewFactory() processor.Factory
- func NewFactoryWithOptions(options ...FactoryOption) processor.Factory
- type Config
- type FactoryOption
- func WithDataPointFunctions(dataPointFunctions []ottl.Factory[*ottldatapoint.TransformContext]) FactoryOption
- func WithDataPointFunctionsNew(dataPointFunctions []ottl.Factory[*ottldatapoint.TransformContext]) FactoryOptiondeprecated
- func WithLogFunctions(logFunctions []ottl.Factory[*ottllog.TransformContext]) FactoryOption
- func WithLogFunctionsNew(logFunctions []ottl.Factory[*ottllog.TransformContext]) FactoryOptiondeprecated
- func WithMetricFunctions(metricFunctions []ottl.Factory[*ottlmetric.TransformContext]) FactoryOption
- func WithMetricFunctionsNew(metricFunctions []ottl.Factory[*ottlmetric.TransformContext]) FactoryOptiondeprecated
- func WithProfileFunctions(profileFunctions []ottl.Factory[*ottlprofile.TransformContext]) FactoryOption
- func WithProfileFunctionsNew(profileFunctions []ottl.Factory[*ottlprofile.TransformContext]) FactoryOptiondeprecated
- func WithResourceFunctions(resourceFunctions []ottl.Factory[*ottlresource.TransformContext]) FactoryOption
- func WithResourceFunctionsNew(resourceFunctions []ottl.Factory[*ottlresource.TransformContext]) FactoryOptiondeprecated
- func WithSpanEventFunctions(spanEventFunctions []ottl.Factory[*ottlspanevent.TransformContext]) FactoryOption
- func WithSpanEventFunctionsNew(spanEventFunctions []ottl.Factory[*ottlspanevent.TransformContext]) FactoryOptiondeprecated
- func WithSpanFunctions(spanFunctions []ottl.Factory[*ottlspan.TransformContext]) FactoryOption
- func WithSpanFunctionsNew(spanFunctions []ottl.Factory[*ottlspan.TransformContext]) FactoryOptiondeprecated
- type LogFilters
- type LogMatchProperties
- type LogMatchType
- type LogSeverityNumberMatchProperties
- type MetricFilters
- type ProfileFilters
- type TraceFilters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDataPointFunctions ¶ added in v0.133.0
func DefaultDataPointFunctions() []ottl.Factory[*ottldatapoint.TransformContext]
func DefaultDataPointFunctionsNew
deprecated
added in
v0.142.0
func DefaultDataPointFunctionsNew() []ottl.Factory[*ottldatapoint.TransformContext]
Deprecated: [v0.152.0] use DefaultDataPointFunctions.
func DefaultLogFunctions ¶ added in v0.133.0
func DefaultLogFunctions() []ottl.Factory[*ottllog.TransformContext]
func DefaultLogFunctionsNew
deprecated
added in
v0.142.0
func DefaultLogFunctionsNew() []ottl.Factory[*ottllog.TransformContext]
Deprecated: [v0.152.0] use DefaultLogFunctions.
func DefaultMetricFunctions ¶ added in v0.133.0
func DefaultMetricFunctions() []ottl.Factory[*ottlmetric.TransformContext]
func DefaultMetricFunctionsNew
deprecated
added in
v0.142.0
func DefaultMetricFunctionsNew() []ottl.Factory[*ottlmetric.TransformContext]
Deprecated: [v0.152.0] use DefaultMetricFunctions.
func DefaultProfileFunctions ¶ added in v0.138.0
func DefaultProfileFunctions() []ottl.Factory[*ottlprofile.TransformContext]
func DefaultProfileFunctionsNew
deprecated
added in
v0.145.0
func DefaultProfileFunctionsNew() []ottl.Factory[*ottlprofile.TransformContext]
Deprecated: [v0.152.0] use DefaultProfileFunctions.
func DefaultResourceFunctions ¶ added in v0.139.0
func DefaultResourceFunctions() []ottl.Factory[*ottlresource.TransformContext]
func DefaultSpanEventFunctions ¶ added in v0.133.0
func DefaultSpanEventFunctions() []ottl.Factory[*ottlspanevent.TransformContext]
func DefaultSpanEventFunctionsNew
deprecated
added in
v0.142.0
func DefaultSpanEventFunctionsNew() []ottl.Factory[*ottlspanevent.TransformContext]
Deprecated: [v0.152.0] use DefaultSpanEventFunctions.
func DefaultSpanFunctions ¶ added in v0.133.0
func DefaultSpanFunctions() []ottl.Factory[*ottlspan.TransformContext]
func DefaultSpanFunctionsNew
deprecated
added in
v0.142.0
func DefaultSpanFunctionsNew() []ottl.Factory[*ottlspan.TransformContext]
Deprecated: [v0.152.0] use DefaultSpanFunctions.
func NewFactory ¶
NewFactory returns a new factory for the Filter processor.
func NewFactoryWithOptions ¶ added in v0.133.0
func NewFactoryWithOptions(options ...FactoryOption) processor.Factory
NewFactoryWithOptions can receive FactoryOption like With*Functions to register non-default OTTL functions in the resulting processor.
Types ¶
type Config ¶
type Config struct {
// ErrorMode determines how the processor reacts to errors that occur while processing an OTTL condition.
// Valid values are `ignore` and `propagate`.
// `ignore` means the processor ignores errors returned by conditions and continues on to the next condition. This is the recommended mode.
// `propagate` means the processor returns the error up the pipeline. This will result in the payload being dropped from the collector.
// The default value is `propagate`. It will change to `ignore` when the `processor.filter.defaultErrorModeIgnore` feature gate is stable.
ErrorMode ottl.ErrorMode `mapstructure:"error_mode"`
// Deprecated: use TraceConditions instead.
Spans filterconfig.MatchConfig `mapstructure:"spans"`
// Deprecated: use MetricConditions instead.
Metrics MetricFilters `mapstructure:"metrics"`
// Deprecated: use LogConditions instead.
Logs LogFilters `mapstructure:"logs"`
// Deprecated: use TraceConditions instead.
Traces TraceFilters `mapstructure:"traces"`
// Deprecated: use ProfileConditions instead.
Profiles ProfileFilters `mapstructure:"profiles"`
MetricConditions []condition.ContextConditions `mapstructure:"metric_conditions"`
LogConditions []condition.ContextConditions `mapstructure:"log_conditions"`
TraceConditions []condition.ContextConditions `mapstructure:"trace_conditions"`
ProfileConditions []condition.ContextConditions `mapstructure:"profile_conditions"`
// contains filtered or unexported fields
}
Config defines configuration for Resource processor.
func (*Config) Unmarshal ¶ added in v0.146.0
Unmarshal is used internally by mapstructure to parse the filterprocessor configuration (Config), adding support to structured and flat configuration styles. When the flat configuration style is used, all conditions are grouped into a common.ContextConditions object, with empty [common.ContextConditions.Context] value. On the other hand, structured configurations are parsed following the mapstructure Config format.
Example of flat configuration:
log_conditions: - resource.attributes["key1"] == "value" - resource.attributes["key2"] == "value"
Example of structured configuration:
log_conditions:
- context: "resource"
conditions:
- attributes["key1"] == "value"
- attributes["key2"] == "value"
type FactoryOption ¶ added in v0.133.0
type FactoryOption func(factory *filterProcessorFactory)
FactoryOption applies changes to filterProcessorFactory.
func WithDataPointFunctions ¶ added in v0.133.0
func WithDataPointFunctions(dataPointFunctions []ottl.Factory[*ottldatapoint.TransformContext]) FactoryOption
WithDataPointFunctions will override the default OTTL datapoint context functions with the provided dataPointFunctions in resulting processor. Subsequent uses of WithDataPointFunctions will merge the provided dataPointFunctions with the previously registered functions.
func WithDataPointFunctionsNew
deprecated
added in
v0.142.0
func WithDataPointFunctionsNew(dataPointFunctions []ottl.Factory[*ottldatapoint.TransformContext]) FactoryOption
Deprecated: [v0.152.0] Use WithDataPointFunctions.
func WithLogFunctions ¶ added in v0.133.0
func WithLogFunctions(logFunctions []ottl.Factory[*ottllog.TransformContext]) FactoryOption
WithLogFunctions will override the default OTTL log context functions with the provided logFunctions in the resulting processor. Subsequent uses of WithLogFunctions will merge the provided logFunctions with the previously registered functions.
func WithLogFunctionsNew
deprecated
added in
v0.142.0
func WithLogFunctionsNew(logFunctions []ottl.Factory[*ottllog.TransformContext]) FactoryOption
Deprecated: [v0.152.0] Use WithLogFunctions.
func WithMetricFunctions ¶ added in v0.133.0
func WithMetricFunctions(metricFunctions []ottl.Factory[*ottlmetric.TransformContext]) FactoryOption
WithMetricFunctions will override the default OTTL metric context functions with the provided metricFunctions in the resulting processor. Subsequent uses of WithMetricFunctions will merge the provided metricFunctions with the previously registered functions.
func WithMetricFunctionsNew
deprecated
added in
v0.142.0
func WithMetricFunctionsNew(metricFunctions []ottl.Factory[*ottlmetric.TransformContext]) FactoryOption
Deprecated: [v0.152.0] Use WithMetricFunctions.
func WithProfileFunctions ¶ added in v0.138.0
func WithProfileFunctions(profileFunctions []ottl.Factory[*ottlprofile.TransformContext]) FactoryOption
WithProfileFunctions will override the default OTTL profile context functions with the provided profileFunctions in the resulting processor. Subsequent uses of WithProfileFunctions will merge the provided profileFunctions with the previously registered functions.
func WithProfileFunctionsNew
deprecated
added in
v0.145.0
func WithProfileFunctionsNew(profileFunctions []ottl.Factory[*ottlprofile.TransformContext]) FactoryOption
Deprecated: [v0.152.0] use WithProfileFunctions.
func WithResourceFunctions ¶ added in v0.139.0
func WithResourceFunctions(resourceFunctions []ottl.Factory[*ottlresource.TransformContext]) FactoryOption
WithResourceFunctions will override the default OTTL resource context functions with the provided resourceFunctions in resulting processor. Subsequent uses of WithResourceFunctions will merge the provided resourceFunctions with the previously registered functions.
func WithResourceFunctionsNew
deprecated
added in
v0.142.0
func WithResourceFunctionsNew(resourceFunctions []ottl.Factory[*ottlresource.TransformContext]) FactoryOption
Deprecated: [v0.152.0] Use WithResourceFunctions.
func WithSpanEventFunctions ¶ added in v0.133.0
func WithSpanEventFunctions(spanEventFunctions []ottl.Factory[*ottlspanevent.TransformContext]) FactoryOption
WithSpanEventFunctions will override the default OTTL spanevent context functions with the provided spanEventFunctions in the resulting processor. Subsequent uses of WithSpanEventFunctions will merge the provided spanEventFunctions with the previously registered functions.
func WithSpanEventFunctionsNew
deprecated
added in
v0.142.0
func WithSpanEventFunctionsNew(spanEventFunctions []ottl.Factory[*ottlspanevent.TransformContext]) FactoryOption
Deprecated: [v0.152.0] Use WithSpanEventFunctions.
func WithSpanFunctions ¶ added in v0.133.0
func WithSpanFunctions(spanFunctions []ottl.Factory[*ottlspan.TransformContext]) FactoryOption
WithSpanFunctions will override the default OTTL span context functions with the provided spanFunctions in the resulting processor. Subsequent uses of WithSpanFunctions will merge the provided spanFunctions with the previously registered functions.
func WithSpanFunctionsNew
deprecated
added in
v0.142.0
func WithSpanFunctionsNew(spanFunctions []ottl.Factory[*ottlspan.TransformContext]) FactoryOption
Deprecated: [v0.152.0] use WithSpanFunctions.
type LogFilters ¶
type LogFilters struct {
// Include match properties describe logs that should be included in the Collector Service pipeline,
// all other logs should be dropped from further processing.
// If both Include and Exclude are specified, Include filtering occurs first.
Include *LogMatchProperties `mapstructure:"include"`
// Exclude match properties describe logs that should be excluded from the Collector Service pipeline,
// all other logs should be included.
// If both Include and Exclude are specified, Include filtering occurs first.
Exclude *LogMatchProperties `mapstructure:"exclude"`
// ResourceConditions is a list of OTTL conditions for an ottlresource context.
// If any condition resolves to true, the whole resource will be dropped.
// Supports `and`, `or`, and `()`
ResourceConditions []string `mapstructure:"resource"`
// LogConditions is a list of OTTL conditions for an ottllog context.
// If any condition resolves to true, the log event will be dropped.
// Supports `and`, `or`, and `()`
LogConditions []string `mapstructure:"log_record"`
}
LogFilters filters by Log properties.
type LogMatchProperties ¶ added in v0.36.0
type LogMatchProperties struct {
// LogMatchType specifies the type of matching desired
LogMatchType LogMatchType `mapstructure:"match_type"`
// ResourceAttributes defines a list of possible resource attributes to match logs against.
// A match occurs if any resource attribute matches all expressions in this given list.
ResourceAttributes []filterconfig.Attribute `mapstructure:"resource_attributes"`
// RecordAttributes defines a list of possible record attributes to match logs against.
// A match occurs if any record attribute matches at least one expression in this given list.
RecordAttributes []filterconfig.Attribute `mapstructure:"record_attributes"`
// SeverityTexts is a list of strings that the LogRecord's severity text field must match
// against.
SeverityTexts []string `mapstructure:"severity_texts"`
// SeverityNumberProperties defines how to match against a log record's SeverityNumber, if defined.
SeverityNumberProperties *LogSeverityNumberMatchProperties `mapstructure:"severity_number"`
// LogBodies is a list of strings that the LogRecord's body field must match
// against.
LogBodies []string `mapstructure:"bodies"`
}
LogMatchProperties specifies the set of properties in a log to match against and the type of string pattern matching to use.
type LogMatchType ¶ added in v0.36.0
type LogMatchType string
LogMatchType specifies the strategy for matching against `plog.Log`s.
type LogSeverityNumberMatchProperties ¶ added in v0.58.0
type LogSeverityNumberMatchProperties struct {
// Min is the minimum severity needed for the log record to match.
// This corresponds to the short names specified here:
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#displaying-severity
// this field is case-insensitive ("INFO" == "info")
Min logSeverity `mapstructure:"min"`
// MatchUndefined lets logs records with "unknown" severity match.
// If MinSeverity is not set, this field is ignored, as fields are not matched based on severity.
MatchUndefined bool `mapstructure:"match_undefined"`
}
type MetricFilters ¶
type MetricFilters struct {
// Include match properties describe metrics that should be included in the Collector Service pipeline,
// all other metrics should be dropped from further processing.
// If both Include and Exclude are specified, Include filtering occurs first.
Include *filterconfig.MetricMatchProperties `mapstructure:"include"`
// Exclude match properties describe metrics that should be excluded from the Collector Service pipeline,
// all other metrics should be included.
// If both Include and Exclude are specified, Include filtering occurs first.
Exclude *filterconfig.MetricMatchProperties `mapstructure:"exclude"`
// RegexpConfig specifies options for the regexp match type
RegexpConfig *regexp.Config `mapstructure:"regexp"`
// ResourceConditions is a list of OTTL conditions for an ottlresource context.
// If any condition resolves to true, the whole resource will be dropped.
// Supports `and`, `or`, and `()`
ResourceConditions []string `mapstructure:"resource"`
// MetricConditions is a list of OTTL conditions for an ottlmetric context.
// If any condition resolves to true, the metric will be dropped.
// Supports `and`, `or`, and `()`
MetricConditions []string `mapstructure:"metric"`
// DataPointConditions is a list of OTTL conditions for an ottldatapoint context.
// If any condition resolves to true, the datapoint will be dropped.
// Supports `and`, `or`, and `()`
DataPointConditions []string `mapstructure:"datapoint"`
}
MetricFilters filters by Metric properties.
type ProfileFilters ¶ added in v0.138.0
type ProfileFilters struct {
// ResourceConditions is a list of OTTL conditions for an ottlresource context.
// If any condition resolves to true, the whole resource will be dropped.
// Supports `and`, `or`, and `()`
ResourceConditions []string `mapstructure:"resource"`
// ProfileConditions is a list of OTTL conditions for an ottlprofile context.
// If any condition resolves to true, the profile will be dropped.
// Supports `and`, `or`, and `()`
ProfileConditions []string `mapstructure:"profile"`
// contains filtered or unexported fields
}
ProfileFilters filters by OTTL conditions
type TraceFilters ¶ added in v0.65.0
type TraceFilters struct {
// ResourceConditions is a list of OTTL conditions for an ottlresource context.
// If any condition resolves to true, the whole resource will be dropped.
// Supports `and`, `or`, and `()`
ResourceConditions []string `mapstructure:"resource"`
// SpanConditions is a list of OTTL conditions for an ottlspan context.
// If any condition resolves to true, the span will be dropped.
// Supports `and`, `or`, and `()`
SpanConditions []string `mapstructure:"span"`
// SpanEventConditions is a list of OTTL conditions for an ottlspanevent context.
// If any condition resolves to true, the span event will be dropped.
// Supports `and`, `or`, and `()`
SpanEventConditions []string `mapstructure:"spanevent"`
}
TraceFilters filters by OTTL conditions