Documentation ¶
Overview ¶
Package config defines the data models for entities. This file defines the models for configuration format. The defined entities are: Config (the top-level structure), Receivers, Exporters, Processors, Pipelines.
Receivers, Exporters and Processors typically have common configuration settings, however sometimes specific implementations will have extra configuration settings. This requires the configuration data for these entities to be polymorphic.
To satisfy these requirements we declare interfaces Receiver, Exporter, Processor, which define the behavior. We also provide helper structs ReceiverSettings, ExporterSettings, ProcessorSettings, which define the common settings and un-marshaling from config files.
Specific Receivers/Exporters/Processors are expected to at the minimum implement the corresponding interface and if they have additional settings they must also extend the corresponding common settings struct (the easiest approach is to embed the common struct).
Index ¶
- Constants
- func NewViper() *viper.Viper
- type Config
- type DataType
- type Exporter
- type ExporterSettings
- type Exporters
- type Extension
- type ExtensionSettings
- type Extensions
- type NamedEntity
- type Parser
- func (l *Parser) AllKeys() []string
- func (l *Parser) Get(key string) interface{}
- func (l *Parser) Set(key string, value interface{})
- func (l *Parser) Sub(key string) (*Parser, error)
- func (l *Parser) ToStringMap() map[string]interface{}
- func (l *Parser) Unmarshal(rawVal interface{}) error
- func (l *Parser) UnmarshalExact(intoCfg interface{}) error
- func (l *Parser) Viper() *viper.Viper
- type Pipeline
- type Pipelines
- type Processor
- type ProcessorSettings
- type Processors
- type Receiver
- type ReceiverSettings
- type Receivers
- type Service
- type Type
Constants ¶
const (
// KeyDelimiter is used as the default key delimiter in the default viper instance.
KeyDelimiter = "::"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶ added in v0.24.0
type Config struct { Receivers Exporters Processors Extensions Service }
Config defines the configuration for the various elements of collector or agent.
func (*Config) Validate ¶ added in v0.24.0
Validate returns an error if the config is invalid.
This function performs basic validation of configuration. There may be more subtle invalid cases that we currently don't check for but which we may want to add in the future (e.g. disallowing receiving and exporting on the same endpoint).
type DataType ¶ added in v0.24.0
type DataType string
DataType is the data type that is supported for collection. We currently support collecting metrics, traces and logs, this can expand in the future.
const ( // TracesDataType is the data type tag for traces. TracesDataType DataType = "traces" // MetricsDataType is the data type tag for metrics. MetricsDataType DataType = "metrics" // LogsDataType is the data type tag for logs. LogsDataType DataType = "logs" )
Currently supported data types. Add new data types here when new types are supported in the future.
type Exporter ¶ added in v0.24.0
type Exporter interface { NamedEntity }
Exporter is the configuration of an exporter.
type ExporterSettings ¶ added in v0.24.0
ExporterSettings defines common settings for an exporter configuration. Specific exporters can embed this struct and extend it with more fields if needed. When embedded in the exporter config it must be with `mapstructure:"-"` tag.
func NewExporterSettings ¶ added in v0.24.0
func NewExporterSettings(typeVal Type) *ExporterSettings
NewExporterSettings return a new ExporterSettings with the given type.
func (*ExporterSettings) Name ¶ added in v0.24.0
func (es *ExporterSettings) Name() string
Name gets the exporter name.
func (*ExporterSettings) SetName ¶ added in v0.24.0
func (es *ExporterSettings) SetName(name string)
SetName sets the exporter name.
func (*ExporterSettings) Type ¶ added in v0.24.0
func (es *ExporterSettings) Type() Type
Type sets the exporter type.
type Extension ¶ added in v0.24.0
type Extension interface { NamedEntity }
Extension is the configuration of a service extension. Specific extensions must implement this interface and will typically embed ExtensionSettings struct or a struct that extends it.
type ExtensionSettings ¶ added in v0.24.0
ExtensionSettings defines common settings for a extension configuration. Specific extensions can embed this struct and extend it with more fields if needed. When embedded in the extension config it must be with `mapstructure:"-"` tag.
func NewExtensionSettings ¶ added in v0.24.0
func NewExtensionSettings(typeVal Type) *ExtensionSettings
NewExtensionSettings return a new ExtensionSettings with the given type.
func (*ExtensionSettings) Name ¶ added in v0.24.0
func (ext *ExtensionSettings) Name() string
Name gets the extension name.
func (*ExtensionSettings) SetName ¶ added in v0.24.0
func (ext *ExtensionSettings) SetName(name string)
SetName sets the extension name.
func (*ExtensionSettings) Type ¶ added in v0.24.0
func (ext *ExtensionSettings) Type() Type
Type sets the extension type.
type Extensions ¶ added in v0.24.0
Extensions is a map of names to extensions.
type NamedEntity ¶ added in v0.24.0
NamedEntity is a configuration entity that has a type and a name.
type Parser ¶ added in v0.24.0
type Parser struct {
// contains filtered or unexported fields
}
Parser loads configuration.
func NewParserFromFile ¶ added in v0.24.0
NewParserFromFile creates a new Parser by reading the given file.
func NewParserFromStringMap ¶ added in v0.24.0
NewParserFromStringMap creates a parser from a map[string]interface{}.
func ParserFromViper ¶ added in v0.24.0
ParserFromViper creates a Parser from a Viper instance.
func (*Parser) AllKeys ¶ added in v0.24.0
AllKeys returns all keys holding a value, regardless of where they are set. Nested keys are returned with a KeyDelimiter separator
func (*Parser) Sub ¶ added in v0.24.0
Sub returns new Parser instance representing a sub tree of this instance.
func (*Parser) ToStringMap ¶ added in v0.24.0
ToStringMap creates a map[string]interface{} from a Parser.
func (*Parser) Unmarshal ¶ added in v0.24.0
Unmarshal unmarshals the config into a struct. Make sure that the tags on the fields of the structure are properly set.
func (*Parser) UnmarshalExact ¶ added in v0.24.0
UnmarshalExact unmarshals the config into a struct, erroring if a field is nonexistent.
type Pipeline ¶ added in v0.24.0
type Pipeline struct { Name string InputType DataType Receivers []string Processors []string Exporters []string }
Pipeline defines a single pipeline.
type Processor ¶ added in v0.24.0
type Processor interface { NamedEntity }
Processor is the configuration of a processor. Specific processors must implement this interface and will typically embed ProcessorSettings struct or a struct that extends it.
type ProcessorSettings ¶ added in v0.24.0
ProcessorSettings defines common settings for a processor configuration. Specific processors can embed this struct and extend it with more fields if needed. When embedded in the processor config it must be with `mapstructure:"-"` tag.
func NewProcessorSettings ¶ added in v0.24.0
func NewProcessorSettings(typeVal Type) *ProcessorSettings
NewProcessorSettings return a new ProcessorSettings with the given type.
func (*ProcessorSettings) Name ¶ added in v0.24.0
func (proc *ProcessorSettings) Name() string
Name gets the processor name.
func (*ProcessorSettings) SetName ¶ added in v0.24.0
func (proc *ProcessorSettings) SetName(name string)
SetName sets the processor name.
func (*ProcessorSettings) Type ¶ added in v0.24.0
func (proc *ProcessorSettings) Type() Type
Type sets the processor type.
type Processors ¶ added in v0.24.0
Processors is a map of names to Processors.
type Receiver ¶ added in v0.24.0
type Receiver interface { NamedEntity // contains filtered or unexported methods }
Receiver is the configuration of a receiver. Specific receivers must implement this interface and will typically embed ReceiverSettings struct or a struct that extends it. Embedded validatable will force each receiver to implement Validate() function
type ReceiverSettings ¶ added in v0.24.0
ReceiverSettings defines common settings for a receiver configuration. Specific receivers can embed this struct and extend it with more fields if needed. It is highly recommended to "override" the Validate() function. When embedded in the processor config it must be with `mapstructure:"-"` tag.
func (*ReceiverSettings) Name ¶ added in v0.24.0
func (rs *ReceiverSettings) Name() string
Name gets the receiver name.
func (*ReceiverSettings) SetName ¶ added in v0.24.0
func (rs *ReceiverSettings) SetName(name string)
SetName sets the receiver name.
func (*ReceiverSettings) Type ¶ added in v0.24.0
func (rs *ReceiverSettings) Type() Type
Type sets the receiver type.
func (*ReceiverSettings) Validate ¶ added in v0.24.0
func (rs *ReceiverSettings) Validate() error
Validate validates the configuration and returns an error if invalid.
type Service ¶ added in v0.24.0
type Service struct { // Extensions is the ordered list of extensions configured for the service. Extensions []string // Pipelines is the set of data pipelines configured for the service. Pipelines Pipelines }
Service defines the configurable components of the service.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package configcheck has checks to be applied to configuration objects implemented by factories of components used in the OpenTelemetry collector.
|
Package configcheck has checks to be applied to configuration objects implemented by factories of components used in the OpenTelemetry collector. |
configcompression
module
|
|
Package configgrpc defines the gRPC configuration settings.
|
Package configgrpc defines the gRPC configuration settings. |
xconfighttp
Module
|
|
configopaque
module
|
|
Package configparser implements loading of configuration from Viper configuration.
|
Package configparser implements loading of configuration from Viper configuration. |
configretry
module
|
|
internal
module
|
|