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 unmarshaling 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 ¶
- func UnmarshalExporter(conf *confmap.Conf, cfg Exporter) error
- func UnmarshalExtension(conf *confmap.Conf, cfg Extension) error
- func UnmarshalProcessor(conf *confmap.Conf, cfg Processor) error
- func UnmarshalReceiver(conf *confmap.Conf, cfg Receiver) error
- type ComponentID
- type Config
- type DataType
- type Exporter
- type ExporterSettings
- type Extension
- type ExtensionSettings
- type Pipeline
- type Pipelinesdeprecated
- type Processor
- type ProcessorSettings
- type Receiver
- type ReceiverSettings
- type Service
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnmarshalExporter ¶ added in v0.50.0
UnmarshalExporter helper function to unmarshal an Exporter config. It checks if the config implements confmap.Unmarshaler and uses that if available, otherwise uses Map.UnmarshalExact, erroring if a field is nonexistent.
func UnmarshalExtension ¶ added in v0.50.0
UnmarshalExtension helper function to unmarshal an Extension config. It checks if the config implements confmap.Unmarshaler and uses that if available, otherwise uses Map.UnmarshalExact, erroring if a field is nonexistent.
func UnmarshalProcessor ¶ added in v0.50.0
UnmarshalProcessor helper function to unmarshal a Processor config. It checks if the config implements confmap.Unmarshaler and uses that if available, otherwise uses Map.UnmarshalExact, erroring if a field is nonexistent.
func UnmarshalReceiver ¶ added in v0.50.0
UnmarshalReceiver helper function to unmarshal a Receiver config. It checks if the config implements confmap.Unmarshaler and uses that if available, otherwise uses Map.UnmarshalExact, erroring if a field is nonexistent.
Types ¶
type ComponentID ¶ added in v0.25.0
type ComponentID struct {
// contains filtered or unexported fields
}
ComponentID represents the identity for a component. It combines two values: * type - the Type of the component. * name - the name of that component. The component ComponentID (combination type + name) is unique for a given component.Kind.
func NewComponentID ¶ added in v0.37.0
func NewComponentID(typeVal Type) ComponentID
NewComponentID returns a new ComponentID with the given Type and empty name.
func NewComponentIDFromString ¶ added in v0.37.0
func NewComponentIDFromString(idStr string) (ComponentID, error)
NewComponentIDFromString decodes a string in type[/name] format into ComponentID. The type and name components will have spaces trimmed, the "type" part must be present, the forward slash and "name" are optional. The returned ComponentID will be invalid if err is not-nil.
func NewComponentIDWithName ¶ added in v0.37.0
func NewComponentIDWithName(typeVal Type, nameVal string) ComponentID
NewComponentIDWithName returns a new ComponentID with the given Type and name.
func (ComponentID) Name ¶ added in v0.25.0
func (id ComponentID) Name() string
Name returns the custom name of the component.
func (ComponentID) String ¶ added in v0.25.0
func (id ComponentID) String() string
String returns the ComponentID string representation as "type[/name]" format.
func (ComponentID) Type ¶ added in v0.25.0
func (id ComponentID) Type() Type
Type returns the type of the component.
func (*ComponentID) UnmarshalText ¶ added in v0.38.0
func (id *ComponentID) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Config ¶ added in v0.24.0
type Config struct { // Receivers is a map of ComponentID to Receivers. Receivers map[ComponentID]Receiver // Exporters is a map of ComponentID to Exporters. Exporters map[ComponentID]Exporter // Processors is a map of ComponentID to Processors. Processors map[ComponentID]Processor // Extensions is a map of ComponentID to extensions. Extensions map[ComponentID]Extension Service }
Config defines the configuration for the various elements of collector or agent. Deprecated: [v0.52.0] Use service.Config
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 = Type
DataType is a special Type that represents the data types supported by the collector. 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 {
// contains filtered or unexported methods
}
Exporter is the configuration of a component.Exporter. Specific extensions must implement this interface and must embed ExporterSettings struct or a struct that extends it.
type ExporterSettings ¶ added in v0.24.0
type ExporterSettings struct {
// contains filtered or unexported fields
}
ExporterSettings defines common settings for a component.Exporter configuration. Specific exporters 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 exporter config, it must be with `mapstructure:",squash"` tag.
func NewExporterSettings ¶ added in v0.24.0
func NewExporterSettings(id ComponentID) ExporterSettings
NewExporterSettings return a new ExporterSettings with the given ComponentID.
func (*ExporterSettings) ID ¶ added in v0.26.0
func (es *ExporterSettings) ID() ComponentID
ID returns the receiver ComponentID.
func (*ExporterSettings) SetIDName ¶ added in v0.26.0
func (es *ExporterSettings) SetIDName(idName string)
SetIDName sets the receiver name.
func (*ExporterSettings) Validate ¶ added in v0.25.0
func (es *ExporterSettings) Validate() error
Validate validates the configuration and returns an error if invalid.
type Extension ¶ added in v0.24.0
type Extension interface {
// contains filtered or unexported methods
}
Extension is the configuration of a component.Extension. Specific extensions must implement this interface and must embed ExtensionSettings struct or a struct that extends it.
type ExtensionSettings ¶ added in v0.24.0
type ExtensionSettings struct {
// contains filtered or unexported fields
}
ExtensionSettings defines common settings for a component.Extension configuration. Specific processors 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 extension config, it must be with `mapstructure:",squash"` tag.
func NewExtensionSettings ¶ added in v0.24.0
func NewExtensionSettings(id ComponentID) ExtensionSettings
NewExtensionSettings return a new ExtensionSettings with the given ComponentID.
func (*ExtensionSettings) ID ¶ added in v0.26.0
func (es *ExtensionSettings) ID() ComponentID
ID returns the receiver ComponentID.
func (*ExtensionSettings) SetIDName ¶ added in v0.26.0
func (es *ExtensionSettings) SetIDName(idName string)
SetIDName sets the receiver name.
func (*ExtensionSettings) Validate ¶ added in v0.25.0
func (es *ExtensionSettings) Validate() error
Validate validates the configuration and returns an error if invalid.
type Pipeline ¶ added in v0.24.0
type Pipeline struct { Receivers []ComponentID `mapstructure:"receivers"` Processors []ComponentID `mapstructure:"processors"` Exporters []ComponentID `mapstructure:"exporters"` }
Pipeline defines a single pipeline. Deprecated: [v0.52.0] Use service.ConfigServicePipeline
type Pipelines
deprecated
added in
v0.24.0
type Pipelines = map[ComponentID]*Pipeline
Deprecated: [v0.52.0] will be removed soon.
type Processor ¶ added in v0.24.0
type Processor interface {
// contains filtered or unexported methods
}
Processor is the configuration of a component.Processor. Specific extensions must implement this interface and must embed ProcessorSettings struct or a struct that extends it.
type ProcessorSettings ¶ added in v0.24.0
type ProcessorSettings struct {
// contains filtered or unexported fields
}
ProcessorSettings defines common settings for a component.Processor configuration. Specific processors 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:",squash"` tag.
func NewProcessorSettings ¶ added in v0.24.0
func NewProcessorSettings(id ComponentID) ProcessorSettings
NewProcessorSettings return a new ProcessorSettings with the given ComponentID.
func (*ProcessorSettings) ID ¶ added in v0.26.0
func (ps *ProcessorSettings) ID() ComponentID
ID returns the receiver ComponentID.
func (*ProcessorSettings) SetIDName ¶ added in v0.26.0
func (ps *ProcessorSettings) SetIDName(idName string)
SetIDName sets the receiver name.
func (*ProcessorSettings) Validate ¶ added in v0.25.0
func (ps *ProcessorSettings) Validate() error
Validate validates the configuration and returns an error if invalid.
type Receiver ¶ added in v0.24.0
type Receiver interface {
// contains filtered or unexported methods
}
Receiver is the configuration of a component.Receiver. Specific extensions must implement this interface and must embed ReceiverSettings struct or a struct that extends it.
type ReceiverSettings ¶ added in v0.24.0
type ReceiverSettings struct {
// contains filtered or unexported fields
}
ReceiverSettings defines common settings for a component.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 receiver config it must be with `mapstructure:",squash"` tag.
func NewReceiverSettings ¶ added in v0.26.0
func NewReceiverSettings(id ComponentID) ReceiverSettings
NewReceiverSettings return a new ReceiverSettings with the given ComponentID.
func (*ReceiverSettings) ID ¶ added in v0.26.0
func (rs *ReceiverSettings) ID() ComponentID
ID returns the receiver ComponentID.
func (*ReceiverSettings) SetIDName ¶ added in v0.26.0
func (rs *ReceiverSettings) SetIDName(idName string)
SetIDName sets the receiver name.
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 { // Telemetry is the configuration for collector's own telemetry. Telemetry telemetry.Config `mapstructure:"telemetry"` // Extensions are the ordered list of extensions configured for the service. Extensions []ComponentID `mapstructure:"extensions"` // Pipelines are the set of data pipelines configured for the service. Pipelines map[ComponentID]*Pipeline `mapstructure:"pipelines"` }
Service defines the configurable components of the service. Deprecated: [v0.52.0] Use service.ConfigService
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package configauth implements the configuration settings to ensure authentication on incoming requests, and allows exporters to add authentication on outgoing requests.
|
Package configauth implements the configuration settings to ensure authentication on incoming requests, and allows exporters to add authentication on outgoing requests. |
Package configgrpc defines the configuration settings to create a gRPC client and server.
|
Package configgrpc defines the configuration settings to create a gRPC client and server. |
Package confighttp defines the configuration settings for creating an HTTP client and server.
|
Package confighttp defines the configuration settings for creating an HTTP client and server. |
xconfighttp
Module
|
|
Package confignet implements the configuration settings for protocols to connect and transport data information.
|
Package confignet implements the configuration settings for protocols to connect and transport data information. |
configopaque
module
|
|
configretry
module
|
|
Package configtelemetry defines various telemetry level for configuration.
|
Package configtelemetry defines various telemetry level for configuration. |
Package configtest provides testing functionality for config package interfaces.
|
Package configtest provides testing functionality for config package interfaces. |
Package configtls implements the TLS settings to load and configure TLS clients and servers.
|
Package configtls implements the TLS settings to load and configure TLS clients and servers. |
experimental
|
|
config
Package config under config/experimental contains configuration related types and interfaces that typically live under the "go.opentelemetry.io/collector/config" package but aren't stable yet to be published there.
|
Package config under config/experimental contains configuration related types and interfaces that typically live under the "go.opentelemetry.io/collector/config" package but aren't stable yet to be published there. |
configsource
Package configsource is an experimental package that defines the interface of "configuration sources," e.g., Vault, ZooKeeper, etcd2, and others.
|
Package configsource is an experimental package that defines the interface of "configuration sources," e.g., Vault, ZooKeeper, etcd2, and others. |
internal
module
|
|
configsource
Package configsource is an internal package that implements methods for injecting, watching, and updating data from ConfigSource into configuration.
|
Package configsource is an internal package that implements methods for injecting, watching, and updating data from ConfigSource into configuration. |