configmodels

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package configmodels 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

Config defines the configuration for the various elements of collector or agent.

func (*Config) Validate added in v0.23.0

func (cfg *Config) Validate() error

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

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

type Exporter interface {
	NamedEntity
}

Exporter is the configuration of an exporter.

type ExporterSettings

type ExporterSettings struct {
	TypeVal Type   `mapstructure:"-"`
	NameVal string `mapstructure:"-"`
}

ExporterSettings defines common settings for an exporter configuration. Specific exporters can embed this struct and extend it with more fields if needed.

func (*ExporterSettings) Name

func (es *ExporterSettings) Name() string

Name gets the exporter name.

func (*ExporterSettings) SetName

func (es *ExporterSettings) SetName(name string)

SetName sets the exporter name.

func (*ExporterSettings) Type

func (es *ExporterSettings) Type() Type

Type sets the exporter type.

type Exporters

type Exporters map[string]Exporter

Exporters is a map of names to Exporters.

type Extension

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

type ExtensionSettings struct {
	TypeVal Type   `mapstructure:"-"`
	NameVal string `mapstructure:"-"`
}

ExtensionSettings defines common settings for a service extension configuration. Specific extensions can embed this struct and extend it with more fields if needed.

func (*ExtensionSettings) Name

func (ext *ExtensionSettings) Name() string

Name gets the extension name.

func (*ExtensionSettings) SetName

func (ext *ExtensionSettings) SetName(name string)

SetName sets the extension name.

func (*ExtensionSettings) Type

func (ext *ExtensionSettings) Type() Type

Type sets the extension type.

type Extensions

type Extensions map[string]Extension

Extensions is a map of names to extensions.

type NamedEntity

type NamedEntity interface {
	Type() Type
	Name() string
	SetName(name string)
}

NamedEntity is a configuration entity that has a type and a name.

type Pipeline

type Pipeline struct {
	Name       string
	InputType  DataType
	Receivers  []string
	Processors []string
	Exporters  []string
}

Pipeline defines a single pipeline.

type Pipelines

type Pipelines map[string]*Pipeline

Pipelines is a map of names to Pipelines.

type Processor

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

type ProcessorSettings struct {
	TypeVal Type   `mapstructure:"-"`
	NameVal string `mapstructure:"-"`
}

ProcessorSettings defines common settings for a processor configuration. Specific processors can embed this struct and extend it with more fields if needed.

func (*ProcessorSettings) Name

func (proc *ProcessorSettings) Name() string

Name gets the processor name.

func (*ProcessorSettings) SetName

func (proc *ProcessorSettings) SetName(name string)

SetName sets the processor name.

func (*ProcessorSettings) Type

func (proc *ProcessorSettings) Type() Type

Type sets the processor type.

type Processors

type Processors map[string]Processor

Processors is a map of names to Processors.

type Receiver

type Receiver interface {
	NamedEntity
}

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.

type ReceiverSettings

type ReceiverSettings struct {
	TypeVal Type   `mapstructure:"-"`
	NameVal string `mapstructure:"-"`
}

ReceiverSettings defines common settings for a receiver configuration. Specific receivers can embed this struct and extend it with more fields if needed.

func (*ReceiverSettings) Name

func (rs *ReceiverSettings) Name() string

Name gets the receiver name.

func (*ReceiverSettings) SetName

func (rs *ReceiverSettings) SetName(name string)

SetName sets the receiver name.

func (*ReceiverSettings) Type

func (rs *ReceiverSettings) Type() Type

Type sets the receiver type.

type Receivers

type Receivers map[string]Receiver

Receivers is a map of names to Receivers.

type Service

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.

type Type

type Type string

Type is the component type as it is used in the config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL