configmodels

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package configmodels defines the data models for entities. This file defines the models for V2 configuration format. The defined entities are: Config (the top-level structure), Receivers, Exporters, Processors, Pipelines.

Index

Constants

View Source
const (
	TracesDataTypeStr  = "traces"
	MetricsDataTypeStr = "metrics"
)

Data type strings.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Receivers  Receivers
	Exporters  Exporters
	Processors Processors
	Pipelines  Pipelines
}

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

type DataType

type DataType int

DataType is the data type that is supported for collection. We currently support collecting metrics and traces, this can expand in the future (e.g. logs, events, etc).

const (

	// TracesDataType is the data type tag for traces.
	TracesDataType DataType

	// MetricsDataType is the data type tag for metrics.
	MetricsDataType
)

Currently supported data types. Add new data types here when new types are supported in the future.

func (DataType) GetString

func (dataType DataType) GetString() string

GetString converts data type to string.

type Exporter

type Exporter interface {
	NamedEntity
	IsEnabled() bool
	Type() string
	SetType(typeStr string)
}

Exporter is the configuration of an exporter.

type ExporterSettings

type ExporterSettings struct {
	TypeVal  string `mapstructure:"-"`
	NameVal  string `mapstructure:"-"`
	Disabled bool   `mapstructure:"disabled"`
}

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

func (*ExporterSettings) IsEnabled

func (es *ExporterSettings) IsEnabled() bool

IsEnabled returns true if the entity is enabled.

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) SetType

func (es *ExporterSettings) SetType(typeStr string)

SetType sets the exporter type.

func (*ExporterSettings) Type

func (es *ExporterSettings) Type() string

Type sets the exporter type.

type Exporters

type Exporters map[string]Exporter

Exporters is a map of names to Exporters.

type NamedEntity

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

NamedEntity is a configuration entity that has a name.

type Pipeline

type Pipeline struct {
	Name       string   `mapstructure:"-"`
	InputType  DataType `mapstructure:"-"`
	Receivers  []string `mapstructure:"receivers"`
	Processors []string `mapstructure:"processors"`
	Exporters  []string `mapstructure:"exporters"`
}

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
	IsEnabled() bool
	Type() string
	SetType(typeStr string)
}

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  string `mapstructure:"-"`
	NameVal  string `mapstructure:"-"`
	Disabled bool   `mapstructure:"disabled"`
}

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

func (*ProcessorSettings) IsEnabled

func (proc *ProcessorSettings) IsEnabled() bool

IsEnabled returns true if the entity is enabled.

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) SetType

func (proc *ProcessorSettings) SetType(typeStr string)

SetType sets the processor type.

func (*ProcessorSettings) Type

func (proc *ProcessorSettings) Type() string

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
	IsEnabled() bool
	Type() string
	SetType(typeStr string)
}

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 string `mapstructure:"-"`
	NameVal string `mapstructure:"-"`
	// Configures if the receiver is disabled and doesn't receive any data.
	// The default value is false(meaning the receiver is enabled by default), and it is expected that receivers
	// continue to use the default value of false.
	Disabled bool `mapstructure:"disabled"`
	// Configures the endpoint in the format 'address:port' for the receiver.
	// The default value is set by the receiver populating the struct.
	Endpoint string `mapstructure:"endpoint"`
}

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

func (*ReceiverSettings) IsEnabled

func (rs *ReceiverSettings) IsEnabled() bool

IsEnabled returns true if the entity is enabled.

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) SetType

func (rs *ReceiverSettings) SetType(typeStr string)

SetType sets the receiver type.

func (*ReceiverSettings) Type

func (rs *ReceiverSettings) Type() string

Type sets the receiver type.

type Receivers

type Receivers map[string]Receiver

Receivers is a map of names to Receivers.

Jump to

Keyboard shortcuts

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