exporter

package module
v0.0.0-...-76a0d45 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 9

README

General Information

An exporter defines how the pipeline data leaves the collector.

This repository hosts the following exporters available in traces, metrics and logs pipelines (sorted alphabetically):

The contrib repository has more exporters available in its builds.

Configuring Exporters

Exporters are configured via YAML under the top-level exporters tag.

The following is a sample configuration for the exampleexporter.

exporters:
  # Exporter 1.
  # <exporter type>:
  exampleexporter:
    # <setting one>: <value one>
    endpoint: 1.2.3.4:8080
    # ...
  # Exporter 2.
  # <exporter type>/<name>:
  exampleexporter/settings:
    # <setting two>: <value two>
    endpoint: 0.0.0.0:9211

An exporter instance is referenced by its full name in other parts of the config, such as in pipelines. A full name consists of the exporter type, '/' and the name appended to the exporter type in the configuration. All exporter full names must be unique.

For the example above:

  • Exporter 1 has full name exampleexporter.
  • Exporter 2 has full name exampleexporter/settings.

Exporters are enabled upon being added to a pipeline. For example:

service:
  pipelines:
    # Valid pipelines are: traces, metrics or logs
    # Trace pipeline 1.
    traces:
      receivers: [examplereceiver]
      processors: []
      exporters: [exampleexporter, exampleexporter/settings]
    # Trace pipeline 2.
    traces/another:
      receivers: [examplereceiver]
      processors: []
      exporters: [exampleexporter, exampleexporter/settings]

Data Ownership

When multiple exporters are configured to send the same data (e.g. by configuring multiple exporters for the same pipeline):

  • exporters not configured to mutate the data will have shared access to the data
  • exporters with the Capabilities to mutate the data will receive a copy of the data

Exporters access export data when ConsumeTraces/ConsumeMetrics/ConsumeLogs function is called. Unless exporter's capabalities include mutation, the exporter MUST NOT modify the pdata.Traces/pdata.Metrics/pdata.Logs argument of these functions. Any approach that does not mutate the original pdata.Traces/pdata.Metrics/pdata.Logs is allowed without the mutation capability.

Proxy Support

Beyond standard YAML configuration as outlined in the individual READMEs above, exporters that leverage the net/http package (all do today) also respect the following proxy environment variables:

  • HTTP_PROXY
  • HTTPS_PROXY
  • NO_PROXY

If set at Collector start time then exporters, regardless of protocol, will or will not proxy traffic as defined by these environment variables.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeFactoryMap

func MakeFactoryMap(factories ...Factory) (map[component.Type]Factory, error)

MakeFactoryMap takes a list of factories and returns a map with Factory type as keys. It returns a non-nil error when there are factories with duplicate type.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder exporter is a helper struct that given a set of Configs and Factories helps with creating exporters.

func NewBuilder

func NewBuilder(cfgs map[component.ID]component.Config, factories map[component.Type]Factory) *Builder

NewBuilder creates a new exporter.Builder to help with creating components form a set of configs and factories.

func (*Builder) CreateLogs

func (b *Builder) CreateLogs(ctx context.Context, set CreateSettings) (Logs, error)

CreateLogs creates a Logs exporter based on the settings and config.

func (*Builder) CreateMetrics

func (b *Builder) CreateMetrics(ctx context.Context, set CreateSettings) (Metrics, error)

CreateMetrics creates a Metrics exporter based on the settings and config.

func (*Builder) CreateTraces

func (b *Builder) CreateTraces(ctx context.Context, set CreateSettings) (Traces, error)

CreateTraces creates a Traces exporter based on the settings and config.

func (*Builder) Factory

func (b *Builder) Factory(componentType component.Type) component.Factory

type CreateLogsFunc

type CreateLogsFunc func(context.Context, CreateSettings, component.Config) (Logs, error)

CreateLogsFunc is the equivalent of Factory.CreateLogs.

func (CreateLogsFunc) CreateLogsExporter

func (f CreateLogsFunc) CreateLogsExporter(ctx context.Context, set CreateSettings, cfg component.Config) (Logs, error)

CreateLogsExporter implements Factory.CreateLogsExporter().

type CreateMetricsFunc

type CreateMetricsFunc func(context.Context, CreateSettings, component.Config) (Metrics, error)

CreateMetricsFunc is the equivalent of Factory.CreateMetrics.

func (CreateMetricsFunc) CreateMetricsExporter

func (f CreateMetricsFunc) CreateMetricsExporter(ctx context.Context, set CreateSettings, cfg component.Config) (Metrics, error)

CreateMetricsExporter implements ExporterFactory.CreateMetricsExporter().

type CreateSettings

type CreateSettings struct {
	// ID returns the ID of the component that will be created.
	ID component.ID

	component.TelemetrySettings

	// BuildInfo can be used by components for informational purposes
	BuildInfo component.BuildInfo
}

CreateSettings configures exporter creators.

type CreateTracesFunc

type CreateTracesFunc func(context.Context, CreateSettings, component.Config) (Traces, error)

CreateTracesFunc is the equivalent of Factory.CreateTraces.

func (CreateTracesFunc) CreateTracesExporter

func (f CreateTracesFunc) CreateTracesExporter(ctx context.Context, set CreateSettings, cfg component.Config) (Traces, error)

CreateTracesExporter implements ExporterFactory.CreateTracesExporter().

type Factory

type Factory interface {
	component.Factory

	// CreateTracesExporter creates a TracesExporter 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 CreateSettings, cfg component.Config) (Traces, error)

	// TracesExporterStability gets the stability level of the TracesExporter.
	TracesExporterStability() component.StabilityLevel

	// CreateMetricsExporter creates a MetricsExporter 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 CreateSettings, cfg component.Config) (Metrics, error)

	// MetricsExporterStability gets the stability level of the MetricsExporter.
	MetricsExporterStability() component.StabilityLevel

	// CreateLogsExporter creates a LogsExporter 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 CreateSettings, cfg component.Config) (Logs, error)

	// LogsExporterStability gets the stability level of the LogsExporter.
	LogsExporterStability() component.StabilityLevel
	// contains filtered or unexported methods
}

Factory is factory interface for exporters.

This interface cannot be directly implemented. Implementations must use the NewFactory to implement it.

func NewFactory

func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory

NewFactory returns a Factory.

type FactoryOption

type FactoryOption interface {
	// contains filtered or unexported methods
}

FactoryOption apply changes to Factory.

func WithLogs

func WithLogs(createLogs CreateLogsFunc, sl component.StabilityLevel) FactoryOption

WithLogs overrides the default "error not supported" implementation for CreateLogsExporter and the default "undefined" stability level.

func WithMetrics

func WithMetrics(createMetrics CreateMetricsFunc, sl component.StabilityLevel) FactoryOption

WithMetrics overrides the default "error not supported" implementation for CreateMetricsExporter and the default "undefined" stability level.

func WithTraces

func WithTraces(createTraces CreateTracesFunc, sl component.StabilityLevel) FactoryOption

WithTraces overrides the default "error not supported" implementation for CreateTracesExporter and the default "undefined" stability level.

type Logs

type Logs interface {
	component.Component
	consumer.Logs
}

Logs is an exporter that can consume logs.

type Metrics

type Metrics interface {
	component.Component
	consumer.Metrics
}

Metrics is an exporter that can consume metrics.

type Traces

type Traces interface {
	component.Component
	consumer.Traces
}

Traces is an exporter that can consume traces.

Directories

Path Synopsis
Package exporterhelper provides helper functions for exporters.
Package exporterhelper provides helper functions for exporters.
internal
nopexporter module
otlpexporter module

Jump to

Keyboard shortcuts

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