Documentation ¶
Overview ¶
Package component outlines the components used in the collector and provides a foundation for the component’s creation and termination process. A component can be either a receiver, exporter, processor, or an extension.
Index ¶
- func MakeExporterFactoryMap(factories ...ExporterFactory) (map[config.Type]ExporterFactory, error)
- func MakeExtensionFactoryMap(factories ...ExtensionFactory) (map[config.Type]ExtensionFactory, error)
- func MakeProcessorFactoryMap(factories ...ProcessorFactory) (map[config.Type]ProcessorFactory, error)
- func MakeReceiverFactoryMap(factories ...ReceiverFactory) (map[config.Type]ReceiverFactory, error)
- type BuildInfo
- type Component
- type CreateExtensionFunc
- type CreateLogsExporterFunc
- type CreateLogsProcessorFunc
- type CreateLogsReceiverFunc
- type CreateMetricsExporterFunc
- type CreateMetricsProcessorFunc
- type CreateMetricsReceiverFunc
- type CreateTracesExporterFunc
- type CreateTracesProcessorFunc
- type CreateTracesReceiverFunc
- type Exporter
- type ExporterCreateDefaultConfigFunc
- type ExporterCreateSettings
- type ExporterFactory
- type ExporterFactoryOption
- type Extension
- type ExtensionCreateSettings
- type ExtensionDefaultConfigFunc
- type ExtensionFactory
- type Factories
- type Factory
- type Host
- type Kind
- type LogsExporter
- type LogsProcessor
- type LogsReceiver
- type MetricsExporter
- type MetricsProcessor
- type MetricsReceiver
- type PipelineWatcher
- type Processor
- type ProcessorCreateDefaultConfigFunc
- type ProcessorCreateSettings
- type ProcessorFactory
- type ProcessorFactoryOption
- type Receiver
- type ReceiverCreateDefaultConfigFunc
- type ReceiverCreateSettings
- type ReceiverFactory
- type ReceiverFactoryOption
- type ShutdownFunc
- type StartFunc
- type TelemetrySettings
- type TracesExporter
- type TracesProcessor
- type TracesReceiver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeExporterFactoryMap ¶
func MakeExporterFactoryMap(factories ...ExporterFactory) (map[config.Type]ExporterFactory, error)
MakeExporterFactoryMap takes a list of exporter factories and returns a map with factory type as keys. It returns a non-nil error when more than one factories have the same type.
func MakeExtensionFactoryMap ¶
func MakeExtensionFactoryMap(factories ...ExtensionFactory) (map[config.Type]ExtensionFactory, error)
MakeExtensionFactoryMap takes a list of extension factories and returns a map with factory type as keys. It returns a non-nil error when more than one factories have the same type.
func MakeProcessorFactoryMap ¶
func MakeProcessorFactoryMap(factories ...ProcessorFactory) (map[config.Type]ProcessorFactory, error)
MakeProcessorFactoryMap takes a list of processor factories and returns a map with factory type as keys. It returns a non-nil error when more than one factories have the same type.
func MakeReceiverFactoryMap ¶
func MakeReceiverFactoryMap(factories ...ReceiverFactory) (map[config.Type]ReceiverFactory, error)
MakeReceiverFactoryMap takes a list of receiver factories and returns a map with factory type as keys. It returns a non-nil error when more than one factories have the same type.
Types ¶
type BuildInfo ¶ added in v0.26.0
type BuildInfo struct { // Executable file name, e.g. "otelcol". Command string // Full name of the collector, e.g. "OpenTelemetry Collector". Description string // Version string. Version string }
BuildInfo is the information that is logged at the application start and passed into each component. This information can be overridden in custom builds.
func NewDefaultBuildInfo ¶ added in v0.37.0
func NewDefaultBuildInfo() BuildInfo
NewDefaultBuildInfo returns a default BuildInfo.
type Component ¶
type Component interface { // Start tells the component to start. Host parameter can be used for communicating // with the host after Start() has already returned. If an error is returned by // Start() then the collector startup will be aborted. // If this is an exporter component it may prepare for exporting // by connecting to the endpoint. // // If the component needs to perform a long-running starting operation then it is recommended // that Start() returns quickly and the long-running operation is performed in background. // In that case make sure that the long-running operation does not use the context passed // to Start() function since that context will be cancelled soon and can abort the long-running // operation. Create a new context from the context.Background() for long-running operations. Start(ctx context.Context, host Host) error // Shutdown is invoked during service shutdown. After Shutdown() is called, if the component // accepted data in any way, it should not accept it anymore. // // If there are any background operations running by the component they must be aborted before // this function returns. Remember that if you started any long-running background operations from // the Start() method, those operations must be also cancelled. If there are any buffers in the // component, they should be cleared and the data sent immediately to the next component. // // The component's lifecycle is completed once the Shutdown() method returns. No other // methods of the component are called after that. If necessary a new component with // the same or different configuration may be created and started (this may happen // for example if we want to restart the component). Shutdown(ctx context.Context) error }
Component is either a receiver, exporter, processor, or an extension.
A component's lifecycle has the following phases:
- Creation: The component is created using its respective factory, via a Create* call.
- Start: The component's Start method is called.
- Running: The component is up and running.
- Shutdown: The component's Shutdown method is called and the lifecycle is complete.
Once the lifecycle is complete it may be repeated, in which case a new component is created, starts, runs and is shutdown again.
type CreateExtensionFunc ¶ added in v0.46.0
type CreateExtensionFunc func(context.Context, ExtensionCreateSettings, config.Extension) (Extension, error)
CreateExtensionFunc is the equivalent of component.ExtensionFactory.CreateExtension()
func (CreateExtensionFunc) CreateExtension ¶ added in v0.46.0
func (f CreateExtensionFunc) CreateExtension(ctx context.Context, set ExtensionCreateSettings, cfg config.Extension) (Extension, error)
CreateExtension implements ExtensionFactory.CreateExtension.
type CreateLogsExporterFunc ¶ added in v0.46.0
type CreateLogsExporterFunc func(context.Context, ExporterCreateSettings, config.Exporter) (LogsExporter, error)
CreateLogsExporterFunc is the equivalent of ExporterFactory.CreateLogsExporter().
func (CreateLogsExporterFunc) CreateLogsExporter ¶ added in v0.46.0
func (f CreateLogsExporterFunc) CreateLogsExporter(ctx context.Context, set ExporterCreateSettings, cfg config.Exporter) (LogsExporter, error)
CreateLogsExporter implements ExporterFactory.CreateLogsExporter().
type CreateLogsProcessorFunc ¶ added in v0.46.0
type CreateLogsProcessorFunc func(context.Context, ProcessorCreateSettings, config.Processor, consumer.Logs) (LogsProcessor, error)
CreateLogsProcessorFunc is the equivalent of ProcessorFactory.CreateLogsProcessor().
func (CreateLogsProcessorFunc) CreateLogsProcessor ¶ added in v0.46.0
func (f CreateLogsProcessorFunc) CreateLogsProcessor( ctx context.Context, set ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Logs, ) (LogsProcessor, error)
CreateLogsProcessor implements ProcessorFactory.CreateLogsProcessor().
type CreateLogsReceiverFunc ¶ added in v0.46.0
type CreateLogsReceiverFunc func(context.Context, ReceiverCreateSettings, config.Receiver, consumer.Logs) (LogsReceiver, error)
CreateLogsReceiverFunc is the equivalent of ReceiverFactory.CreateLogsReceiver().
func (CreateLogsReceiverFunc) CreateLogsReceiver ¶ added in v0.46.0
func (f CreateLogsReceiverFunc) CreateLogsReceiver( ctx context.Context, set ReceiverCreateSettings, cfg config.Receiver, nextConsumer consumer.Logs, ) (LogsReceiver, error)
CreateLogsReceiver implements ReceiverFactory.CreateLogsReceiver().
type CreateMetricsExporterFunc ¶ added in v0.46.0
type CreateMetricsExporterFunc func(context.Context, ExporterCreateSettings, config.Exporter) (MetricsExporter, error)
CreateMetricsExporterFunc is the equivalent of ExporterFactory.CreateMetricsExporter().
func (CreateMetricsExporterFunc) CreateMetricsExporter ¶ added in v0.46.0
func (f CreateMetricsExporterFunc) CreateMetricsExporter(ctx context.Context, set ExporterCreateSettings, cfg config.Exporter) (MetricsExporter, error)
CreateMetricsExporter implements ExporterFactory.CreateMetricsExporter().
type CreateMetricsProcessorFunc ¶ added in v0.46.0
type CreateMetricsProcessorFunc func(context.Context, ProcessorCreateSettings, config.Processor, consumer.Metrics) (MetricsProcessor, error)
CreateMetricsProcessorFunc is the equivalent of ProcessorFactory.CreateMetricsProcessor().
func (CreateMetricsProcessorFunc) CreateMetricsProcessor ¶ added in v0.46.0
func (f CreateMetricsProcessorFunc) CreateMetricsProcessor( ctx context.Context, set ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Metrics, ) (MetricsProcessor, error)
CreateMetricsProcessor implements ProcessorFactory.CreateMetricsProcessor().
type CreateMetricsReceiverFunc ¶ added in v0.46.0
type CreateMetricsReceiverFunc func(context.Context, ReceiverCreateSettings, config.Receiver, consumer.Metrics) (MetricsReceiver, error)
CreateMetricsReceiverFunc is the equivalent of ReceiverFactory.CreateMetricsReceiver().
func (CreateMetricsReceiverFunc) CreateMetricsReceiver ¶ added in v0.46.0
func (f CreateMetricsReceiverFunc) CreateMetricsReceiver( ctx context.Context, set ReceiverCreateSettings, cfg config.Receiver, nextConsumer consumer.Metrics, ) (MetricsReceiver, error)
CreateMetricsReceiver implements ReceiverFactory.CreateMetricsReceiver().
type CreateTracesExporterFunc ¶ added in v0.46.0
type CreateTracesExporterFunc func(context.Context, ExporterCreateSettings, config.Exporter) (TracesExporter, error)
CreateTracesExporterFunc is the equivalent of ExporterFactory.CreateTracesExporter().
func (CreateTracesExporterFunc) CreateTracesExporter ¶ added in v0.46.0
func (f CreateTracesExporterFunc) CreateTracesExporter(ctx context.Context, set ExporterCreateSettings, cfg config.Exporter) (TracesExporter, error)
CreateTracesExporter implements ExporterFactory.CreateTracesExporter().
type CreateTracesProcessorFunc ¶ added in v0.46.0
type CreateTracesProcessorFunc func(context.Context, ProcessorCreateSettings, config.Processor, consumer.Traces) (TracesProcessor, error)
CreateTracesProcessorFunc is the equivalent of ProcessorFactory.CreateTracesProcessor().
func (CreateTracesProcessorFunc) CreateTracesProcessor ¶ added in v0.46.0
func (f CreateTracesProcessorFunc) CreateTracesProcessor( ctx context.Context, set ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces) (TracesProcessor, error)
CreateTracesProcessor implements ProcessorFactory.CreateTracesProcessor().
type CreateTracesReceiverFunc ¶ added in v0.46.0
type CreateTracesReceiverFunc func(context.Context, ReceiverCreateSettings, config.Receiver, consumer.Traces) (TracesReceiver, error)
CreateTracesReceiverFunc is the equivalent of ReceiverFactory.CreateTracesReceiver().
func (CreateTracesReceiverFunc) CreateTracesReceiver ¶ added in v0.46.0
func (f CreateTracesReceiverFunc) CreateTracesReceiver( ctx context.Context, set ReceiverCreateSettings, cfg config.Receiver, nextConsumer consumer.Traces) (TracesReceiver, error)
CreateTracesReceiver implements ReceiverFactory.CreateTracesReceiver().
type Exporter ¶
type Exporter interface { Component }
Exporter exports telemetry data from the collector to a destination.
type ExporterCreateDefaultConfigFunc ¶ added in v0.46.0
ExporterCreateDefaultConfigFunc is the equivalent of ExporterFactory.CreateDefaultConfig().
func (ExporterCreateDefaultConfigFunc) CreateDefaultConfig ¶ added in v0.46.0
func (f ExporterCreateDefaultConfigFunc) CreateDefaultConfig() config.Exporter
CreateDefaultConfig implements ExporterFactory.CreateDefaultConfig().
type ExporterCreateSettings ¶ added in v0.28.0
type ExporterCreateSettings struct { TelemetrySettings // BuildInfo can be used by components for informational purposes BuildInfo BuildInfo }
ExporterCreateSettings configures Exporter creators.
type ExporterFactory ¶
type ExporterFactory interface { Factory // CreateDefaultConfig creates the default configuration for the Exporter. // This method can be called multiple times depending on the pipeline // configuration and should not cause side-effects that prevent the creation // of multiple instances of the Exporter. // The object returned by this method needs to pass the checks implemented by // 'configtest.CheckConfigStruct'. It is recommended to have these checks in the // tests of any implementation of the Factory interface. CreateDefaultConfig() config.Exporter // CreateTracesExporter creates a trace exporter based on this config. // If the exporter type does not support tracing or if the config is not valid, // an error will be returned instead. CreateTracesExporter(ctx context.Context, set ExporterCreateSettings, cfg config.Exporter) (TracesExporter, error) // CreateMetricsExporter creates a metrics exporter based on this config. // If the exporter type does not support metrics or if the config is not valid, // an error will be returned instead. CreateMetricsExporter(ctx context.Context, set ExporterCreateSettings, cfg config.Exporter) (MetricsExporter, error) // CreateLogsExporter creates an exporter based on the config. // If the exporter type does not support logs or if the config is not valid, // an error will be returned instead. CreateLogsExporter(ctx context.Context, set ExporterCreateSettings, cfg config.Exporter) (LogsExporter, error) }
ExporterFactory is factory interface for exporters.
This interface cannot be directly implemented. Implementations must use the NewExporterFactory to implement it.
func NewExporterFactory ¶ added in v0.46.0
func NewExporterFactory(cfgType config.Type, createDefaultConfig ExporterCreateDefaultConfigFunc, options ...ExporterFactoryOption) ExporterFactory
NewExporterFactory returns a ExporterFactory.
type ExporterFactoryOption ¶ added in v0.46.0
type ExporterFactoryOption func(o *exporterFactory)
ExporterFactoryOption apply changes to ExporterOptions.
func WithLogsExporter ¶ added in v0.46.0
func WithLogsExporter(createLogsExporter CreateLogsExporterFunc) ExporterFactoryOption
WithLogsExporter overrides the default "error not supported" implementation for CreateLogsExporter.
func WithMetricsExporter ¶ added in v0.46.0
func WithMetricsExporter(createMetricsExporter CreateMetricsExporterFunc) ExporterFactoryOption
WithMetricsExporter overrides the default "error not supported" implementation for CreateMetricsExporter.
func WithTracesExporter ¶ added in v0.46.0
func WithTracesExporter(createTracesExporter CreateTracesExporterFunc) ExporterFactoryOption
WithTracesExporter overrides the default "error not supported" implementation for CreateTracesExporter.
type Extension ¶ added in v0.22.0
type Extension interface { Component }
Extension is the interface for objects hosted by the OpenTelemetry Collector that don't participate directly on data pipelines but provide some functionality to the service, examples: health check endpoint, z-pages, etc.
type ExtensionCreateSettings ¶ added in v0.28.0
type ExtensionCreateSettings struct { TelemetrySettings // BuildInfo can be used by components for informational purposes BuildInfo BuildInfo }
ExtensionCreateSettings is passed to ExtensionFactory.Create* functions.
type ExtensionDefaultConfigFunc ¶ added in v0.46.0
ExtensionDefaultConfigFunc is the equivalent of component.ExtensionFactory.CreateDefaultConfig()
func (ExtensionDefaultConfigFunc) CreateDefaultConfig ¶ added in v0.46.0
func (f ExtensionDefaultConfigFunc) CreateDefaultConfig() config.Extension
CreateDefaultConfig implements ExtensionFactory.CreateDefaultConfig()
type ExtensionFactory ¶
type ExtensionFactory interface { Factory // CreateDefaultConfig creates the default configuration for the Extension. // This method can be called multiple times depending on the pipeline // configuration and should not cause side-effects that prevent the creation // of multiple instances of the Extension. // The object returned by this method needs to pass the checks implemented by // 'configtest.CheckConfigStruct'. It is recommended to have these checks in the // tests of any implementation of the Factory interface. CreateDefaultConfig() config.Extension // CreateExtension creates an extension based on the given config. CreateExtension(ctx context.Context, set ExtensionCreateSettings, cfg config.Extension) (Extension, error) }
ExtensionFactory is a factory for extensions to the service.
func NewExtensionFactory ¶ added in v0.46.0
func NewExtensionFactory( cfgType config.Type, createDefaultConfig ExtensionDefaultConfigFunc, createServiceExtension CreateExtensionFunc) ExtensionFactory
type Factories ¶ added in v0.7.0
type Factories struct { // Receivers maps receiver type names in the config to the respective factory. Receivers map[config.Type]ReceiverFactory // Processors maps processor type names in the config to the respective factory. Processors map[config.Type]ProcessorFactory // Exporters maps exporter type names in the config to the respective factory. Exporters map[config.Type]ExporterFactory // Extensions maps extension type names in the config to the respective factory. Extensions map[config.Type]ExtensionFactory }
Factories struct holds in a single type all component factories that can be handled by the Config.
type Factory ¶
type Factory interface { // Type gets the type of the component created by this factory. Type() config.Type // contains filtered or unexported methods }
Factory is implemented by all component factories.
This interface cannot be directly implemented. Implementations must use the factory helpers for the appropriate component type.
type Host ¶
type Host interface { // ReportFatalError is used to report to the host that the component // encountered a fatal error (i.e.: an error that the instance can't recover // from) after its start function had already returned. // // ReportFatalError should be called by the component anytime after Component.Start() ends and // before Component.Shutdown() begins. ReportFatalError(err error) // GetFactory of the specified kind. Returns the factory for a component type. // This allows components to create other components. For example: // func (r MyReceiver) Start(host component.Host) error { // apacheFactory := host.GetFactory(KindReceiver,"apache").(component.ReceiverFactory) // receiver, err := apacheFactory.CreateMetricsReceiver(...) // ... // } // // GetFactory can be called by the component anytime after Component.Start() begins and // until Component.Shutdown() ends. Note that the component is responsible for destroying // other components that it creates. GetFactory(kind Kind, componentType config.Type) Factory // GetExtensions returns the map of extensions. Only enabled and created extensions will be returned. // Typically is used to find an extension by type or by full config name. Both cases // can be done by iterating the returned map. There are typically very few extensions, // so there are no performance implications due to iteration. // // GetExtensions can be called by the component anytime after Component.Start() begins and // until Component.Shutdown() ends. GetExtensions() map[config.ComponentID]Extension // GetExporters returns the map of exporters. Only enabled and created exporters will be returned. // Typically is used to find exporters by type or by full config name. Both cases // can be done by iterating the returned map. There are typically very few exporters, // so there are no performance implications due to iteration. // This returns a map by DataType of maps by exporter configs to the exporter instance. // Note that an exporter with the same name may be attached to multiple pipelines and // thus we may have an instance of the exporter for multiple data types. // This is an experimental function that may change or even be removed completely. // // GetExporters can be called by the component anytime after Component.Start() begins and // until Component.Shutdown() ends. GetExporters() map[config.DataType]map[config.ComponentID]Exporter }
Host represents the entity that is hosting a Component. It is used to allow communication between the Component and its host (normally the service.Collector is the host).
type Kind ¶
type Kind int
Kind represents component kinds.
const ( KindReceiver Kind KindProcessor KindExporter KindExtension )
type LogsExporter ¶ added in v0.7.0
LogsExporter is an Exporter that can consume logs.
type LogsProcessor ¶ added in v0.7.0
LogsProcessor is a processor that can consume logs.
type LogsReceiver ¶ added in v0.7.0
type LogsReceiver interface { Receiver }
A LogsReceiver receives logs. Its purpose is to translate data from any format to the collector's internal logs data format. LogsReceiver feeds a consumer.Logs with data.
For example a LogsReceiver can read syslogs and convert them into pdata.Logs.
type MetricsExporter ¶
MetricsExporter is an Exporter that can consume metrics.
type MetricsProcessor ¶
MetricsProcessor is a processor that can consume metrics.
type MetricsReceiver ¶
type MetricsReceiver interface { Receiver }
A MetricsReceiver receives metrics. Its purpose is to translate data from any format to the collector's internal metrics format. MetricsReceiver feeds a consumer.Metrics with data.
For example it could be Prometheus data source which translates Prometheus metrics into pdata.Metrics.
type PipelineWatcher ¶
type PipelineWatcher interface { // Ready notifies the Extension that all pipelines were built and the // receivers were started, i.e.: the service is ready to receive data // (note that it may already have received data when this method is called). Ready() error // NotReady notifies the Extension that all receivers are about to be stopped, // i.e.: pipeline receivers will not accept new data. // This is sent before receivers are stopped, so the Extension can take any // appropriate actions before that happens. NotReady() error }
PipelineWatcher is an extra interface for Extension hosted by the OpenTelemetry Collector that is to be implemented by extensions interested in changes to pipeline states. Typically this will be used by extensions that change their behavior if data is being ingested or not, e.g.: a k8s readiness probe.
type Processor ¶
type Processor interface { Component }
Processor defines the common functions that must be implemented by TracesProcessor and MetricsProcessor.
type ProcessorCreateDefaultConfigFunc ¶ added in v0.46.0
ProcessorCreateDefaultConfigFunc is the equivalent of ProcessorFactory.CreateDefaultConfig().
func (ProcessorCreateDefaultConfigFunc) CreateDefaultConfig ¶ added in v0.46.0
func (f ProcessorCreateDefaultConfigFunc) CreateDefaultConfig() config.Processor
CreateDefaultConfig implements ProcessorFactory.CreateDefaultConfig().
type ProcessorCreateSettings ¶ added in v0.28.0
type ProcessorCreateSettings struct { TelemetrySettings // BuildInfo can be used by components for informational purposes BuildInfo BuildInfo }
ProcessorCreateSettings is passed to Create* functions in ProcessorFactory.
type ProcessorFactory ¶
type ProcessorFactory interface { Factory // CreateDefaultConfig creates the default configuration for the Processor. // This method can be called multiple times depending on the pipeline // configuration and should not cause side-effects that prevent the creation // of multiple instances of the Processor. // The object returned by this method needs to pass the checks implemented by // 'configtest.CheckConfigStruct'. It is recommended to have these checks in the // tests of any implementation of the Factory interface. CreateDefaultConfig() config.Processor // CreateTracesProcessor creates a trace processor based on this config. // If the processor type does not support tracing or if the config is not valid, // an error will be returned instead. CreateTracesProcessor( ctx context.Context, set ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces, ) (TracesProcessor, error) // CreateMetricsProcessor creates a metrics processor based on this config. // If the processor type does not support metrics or if the config is not valid, // an error will be returned instead. CreateMetricsProcessor( ctx context.Context, set ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Metrics, ) (MetricsProcessor, error) // CreateLogsProcessor creates a processor based on the config. // If the processor type does not support logs or if the config is not valid, // an error will be returned instead. CreateLogsProcessor( ctx context.Context, set ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Logs, ) (LogsProcessor, error) }
ProcessorFactory is Factory interface for processors.
This interface cannot be directly implemented. Implementations must use the NewProcessorFactory to implement it.
func NewProcessorFactory ¶ added in v0.46.0
func NewProcessorFactory(cfgType config.Type, createDefaultConfig ProcessorCreateDefaultConfigFunc, options ...ProcessorFactoryOption) ProcessorFactory
NewProcessorFactory returns a ProcessorFactory.
type ProcessorFactoryOption ¶ added in v0.46.0
type ProcessorFactoryOption func(o *processorFactory)
ProcessorFactoryOption apply changes to ProcessorOptions.
func WithLogsProcessor ¶ added in v0.46.0
func WithLogsProcessor(createLogsProcessor CreateLogsProcessorFunc) ProcessorFactoryOption
WithLogsProcessor overrides the default "error not supported" implementation for CreateLogsProcessor.
func WithMetricsProcessor ¶ added in v0.46.0
func WithMetricsProcessor(createMetricsProcessor CreateMetricsProcessorFunc) ProcessorFactoryOption
WithMetricsProcessor overrides the default "error not supported" implementation for CreateMetricsProcessor.
func WithTracesProcessor ¶ added in v0.46.0
func WithTracesProcessor(createTracesProcessor CreateTracesProcessorFunc) ProcessorFactoryOption
WithTracesProcessor overrides the default "error not supported" implementation for CreateTracesProcessor.
type Receiver ¶
type Receiver interface { Component }
Receiver allows the collector to receive metrics, traces and logs.
Receiver receives data from a source (either from a remote source via network or scrapes from a local host) and pushes the data to the pipelines it is attached to by calling the nextConsumer.Consume*() function.
Error Handling ============== The nextConsumer.Consume*() function may return an error to indicate that the data was not accepted. There are 2 types of possible errors: Permanent and non-Permanent. The receiver must check the type of the error using IsPermanent() helper.
If the error is Permanent, then the nextConsumer.Consume*() call should not be retried with the same data. This typically happens when the data cannot be serialized by the exporter that is attached to the pipeline or when the destination refuses the data because it cannot decode it. The receiver must indicate to the source from which it received the data that the received data was bad, if the receiving protocol allows to do that. In case of OTLP/HTTP for example, this means that HTTP 400 response is returned to the sender.
If the error is non-Permanent then the nextConsumer.Consume*() call may be retried with the same data. This may be done by the receiver itself, however typically it is done by the original sender, after the receiver returns a response to the sender indicating that the Collector is currently overloaded and the request must be retried. In case of OTLP/HTTP for example, this means that HTTP 429 or 503 response is returned.
Acknowledgment Handling ======================= The receivers that receive data via a network protocol that support acknowledgments MUST follow this order of operations:
- Receive data from some sender (typically from a network).
- Push received data to the pipeline by calling nextConsumer.Consume*() function.
- Acknowledge successful data receipt to the sender if Consume*() succeeded or return a failure to the sender if Consume*() returned an error.
This ensures there are strong delivery guarantees once the data is acknowledged by the Collector.
type ReceiverCreateDefaultConfigFunc ¶ added in v0.46.0
ReceiverCreateDefaultConfigFunc is the equivalent of ReceiverFactory.CreateDefaultConfig().
func (ReceiverCreateDefaultConfigFunc) CreateDefaultConfig ¶ added in v0.46.0
func (f ReceiverCreateDefaultConfigFunc) CreateDefaultConfig() config.Receiver
CreateDefaultConfig implements ReceiverFactory.CreateDefaultConfig().
type ReceiverCreateSettings ¶ added in v0.28.0
type ReceiverCreateSettings struct { TelemetrySettings // BuildInfo can be used by components for informational purposes. BuildInfo BuildInfo }
ReceiverCreateSettings configures Receiver creators.
type ReceiverFactory ¶
type ReceiverFactory interface { Factory // CreateDefaultConfig creates the default configuration for the Receiver. // This method can be called multiple times depending on the pipeline // configuration and should not cause side-effects that prevent the creation // of multiple instances of the Receiver. // The object returned by this method needs to pass the checks implemented by // 'configtest.CheckConfigStruct'. It is recommended to have these checks in the // tests of any implementation of the Factory interface. CreateDefaultConfig() config.Receiver // CreateTracesReceiver creates a trace receiver based on this config. // If the receiver type does not support tracing or if the config is not valid // an error will be returned instead. CreateTracesReceiver(ctx context.Context, set ReceiverCreateSettings, cfg config.Receiver, nextConsumer consumer.Traces) (TracesReceiver, error) // CreateMetricsReceiver creates a metrics receiver based on this config. // If the receiver type does not support metrics or if the config is not valid // an error will be returned instead. CreateMetricsReceiver(ctx context.Context, set ReceiverCreateSettings, cfg config.Receiver, nextConsumer consumer.Metrics) (MetricsReceiver, error) // CreateLogsReceiver creates a log receiver based on this config. // If the receiver type does not support the data type or if the config is not valid // an error will be returned instead. CreateLogsReceiver(ctx context.Context, set ReceiverCreateSettings, cfg config.Receiver, nextConsumer consumer.Logs) (LogsReceiver, error) }
ReceiverFactory is factory interface for receivers.
This interface cannot be directly implemented. Implementations must use the NewReceiverFactory to implement it.
func NewReceiverFactory ¶ added in v0.46.0
func NewReceiverFactory(cfgType config.Type, createDefaultConfig ReceiverCreateDefaultConfigFunc, options ...ReceiverFactoryOption) ReceiverFactory
NewReceiverFactory returns a ReceiverFactory.
type ReceiverFactoryOption ¶ added in v0.46.0
type ReceiverFactoryOption func(o *receiverFactory)
ReceiverFactoryOption apply changes to ReceiverOptions.
func WithLogsReceiver ¶ added in v0.46.0
func WithLogsReceiver(createLogsReceiver CreateLogsReceiverFunc) ReceiverFactoryOption
WithLogsReceiver overrides the default "error not supported" implementation for CreateLogsReceiver.
func WithMetricsReceiver ¶ added in v0.46.0
func WithMetricsReceiver(createMetricsReceiver CreateMetricsReceiverFunc) ReceiverFactoryOption
WithMetricsReceiver overrides the default "error not supported" implementation for CreateMetricsReceiver.
func WithTracesReceiver ¶ added in v0.46.0
func WithTracesReceiver(createTracesReceiver CreateTracesReceiverFunc) ReceiverFactoryOption
WithTracesReceiver overrides the default "error not supported" implementation for CreateTracesReceiver.
type ShutdownFunc ¶ added in v0.46.0
ShutdownFunc specifies the function invoked when the component.Component is being shutdown.
type StartFunc ¶ added in v0.46.0
StartFunc specifies the function invoked when the component.Component is being started.
type TelemetrySettings ¶ added in v0.35.0
type TelemetrySettings struct { // Logger that the factory can use during creation and can pass to the created // component to be used later as well. Logger *zap.Logger // TracerProvider that the factory can pass to other instrumented third-party libraries. TracerProvider trace.TracerProvider // MeterProvider that the factory can pass to other instrumented third-party libraries. MeterProvider metric.MeterProvider // MetricsLevel controls the level of detail for metrics emitted by the collector. // Experimental: *NOTE* this field is experimental and may be changed or removed. MetricsLevel configtelemetry.Level }
type TracesExporter ¶ added in v0.14.0
TracesExporter is an Exporter that can consume traces.
type TracesProcessor ¶ added in v0.14.0
TracesProcessor is a processor that can consume traces.
type TracesReceiver ¶ added in v0.14.0
type TracesReceiver interface { Receiver }
A TracesReceiver receives traces. Its purpose is to translate data from any format to the collector's internal trace format. TracesReceiver feeds a consumer.Traces with data.
For example it could be Zipkin data source which translates Zipkin spans into pdata.Traces.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package componenterror provides helper functions to create and process OpenTelemetry component errors.
|
Package componenterror provides helper functions to create and process OpenTelemetry component errors. |
Package componenthelper assists with the creation of a new component.Component.
|
Package componenthelper assists with the creation of a new component.Component. |
componentprofiles
module
|
|
componentstatus
module
|
|
Package componenttest define types and functions used to help test packages implementing the component package interfaces.
|
Package componenttest define types and functions used to help test packages implementing the component package interfaces. |
experimental
|
|
component
Package component under config/experimental contains types and interfaces that typically live under the "go.opentelemetry.io/collector/component" package but aren't stable yet to be published there.
|
Package component under config/experimental contains types and interfaces that typically live under the "go.opentelemetry.io/collector/component" package but aren't stable yet to be published there. |