processor/attributesprocessor/config.go (18 lines of code) (raw):

// Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 package attributesprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor" import ( "errors" "go.opentelemetry.io/collector/component" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/attraction" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter/filterconfig" ) // Config specifies the set of attributes to be inserted, updated, upserted and // deleted and the properties to include/exclude a span from being processed. // This processor handles all forms of modifications to attributes within a span, log, or metric. // Prior to any actions being applied, each span is compared against // the include properties and then the exclude properties if they are specified. // This determines if a span is to be processed or not. // The list of actions is applied in order specified in the configuration. type Config struct { filterconfig.MatchConfig `mapstructure:",squash"` // Specifies the list of attributes to act on. // The set of actions are {INSERT, UPDATE, UPSERT, DELETE, HASH, EXTRACT}. // This is a required field. attraction.Settings `mapstructure:",squash"` } var _ component.Config = (*Config)(nil) // Validate checks if the processor configuration is valid func (cfg *Config) Validate() error { if len(cfg.Actions) == 0 { return errors.New("missing required field \"actions\"") } return nil }