exporterhelper

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

README

Exporter Helper

This is a helper exporter that other exporters can depend on. Today, it primarily offers queued retries and resource attributes to metric labels conversion.

⚠ This exporter should not be added to a service pipeline.

Configuration

The following configuration options can be modified:

  • retry_on_failure
    • enabled (default = true)
    • initial_interval (default = 5s): Time to wait after the first failure before retrying; ignored if enabled is false
    • max_interval (default = 30s): Is the upper bound on backoff; ignored if enabled is false
    • max_elapsed_time (default = 120s): Is the maximum amount of time spent trying to send a batch; ignored if enabled is false
  • sending_queue
    • enabled (default = true)
    • num_consumers (default = 10): Number of consumers that dequeue batches; ignored if enabled is false
    • queue_size (default = 5000): Maximum number of batches kept in memory before data; ignored if enabled is false; User should calculate this as num_seconds * requests_per_second where:
      • num_seconds is the number of seconds to buffer in case of a backend outage
      • requests_per_second is the average number of requests per seconds.
  • resource_to_telemetry_conversion
    • enabled (default = false): If enabled is true, all the resource attributes will be converted to metric labels by default.
  • timeout (default = 5s): Time to wait per individual attempt to send data to a backend.

The full list of settings exposed for this helper exporter are documented here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory(
	cfgType configmodels.Type,
	createDefaultConfig CreateDefaultConfig,
	options ...FactoryOption) component.ExporterFactory

NewFactory returns a component.ExporterFactory.

func NewLogsExporter

func NewLogsExporter(
	cfg configmodels.Exporter,
	logger *zap.Logger,
	pusher PushLogs,
	options ...Option,
) (component.LogsExporter, error)

NewLogsExporter creates an LogsExporter that records observability metrics and wraps every request with a Span.

func NewMetricsExporter

func NewMetricsExporter(
	cfg configmodels.Exporter,
	logger *zap.Logger,
	pusher PushMetrics,
	options ...Option,
) (component.MetricsExporter, error)

NewMetricsExporter creates an MetricsExporter that records observability metrics and wraps every request with a Span.

func NewThrottleRetry

func NewThrottleRetry(err error, delay time.Duration) error

func NewTraceExporter

func NewTraceExporter(
	cfg configmodels.Exporter,
	logger *zap.Logger,
	pusher PushTraces,
	options ...Option,
) (component.TracesExporter, error)

NewTraceExporter creates a TracesExporter that records observability metrics and wraps every request with a Span.

Types

type CreateDefaultConfig

type CreateDefaultConfig func() configmodels.Exporter

CreateDefaultConfig is the equivalent of component.ExporterFactory.CreateDefaultConfig()

type CreateLogsExporter

CreateMetricsExporter is the equivalent of component.ExporterFactory.CreateLogsExporter()

type CreateMetricsExporter

CreateMetricsExporter is the equivalent of component.ExporterFactory.CreateMetricsExporter()

type CreateTraceExporter

CreateTraceExporter is the equivalent of component.ExporterFactory.CreateTracesExporter()

type FactoryOption

type FactoryOption func(o *factory)

FactoryOption apply changes to ExporterOptions.

func WithCustomUnmarshaler

func WithCustomUnmarshaler(customUnmarshaler component.CustomUnmarshaler) FactoryOption

WithCustomUnmarshaler implements component.ConfigUnmarshaler.

func WithLogs

func WithLogs(createLogsExporter CreateLogsExporter) FactoryOption

WithLogs overrides the default "error not supported" implementation for CreateLogsReceiver.

func WithMetrics

func WithMetrics(createMetricsExporter CreateMetricsExporter) FactoryOption

WithMetrics overrides the default "error not supported" implementation for CreateMetricsReceiver.

func WithTraces

func WithTraces(createTraceExporter CreateTraceExporter) FactoryOption

WithTraces overrides the default "error not supported" implementation for CreateTracesReceiver.

type Option

type Option func(*baseSettings)

Option apply changes to baseSettings.

func WithQueue

func WithQueue(queueSettings QueueSettings) Option

WithQueue overrides the default QueueSettings for an exporter. The default QueueSettings is to disable queueing.

func WithResourceToTelemetryConversion

func WithResourceToTelemetryConversion(resourceToTelemetrySettings ResourceToTelemetrySettings) Option

WithResourceToTelemetryConversion overrides the default ResourceToTelemetrySettings for an exporter. The default ResourceToTelemetrySettings is to disable resource attributes to metric labels conversion.

func WithRetry

func WithRetry(retrySettings RetrySettings) Option

WithRetry overrides the default RetrySettings for an exporter. The default RetrySettings is to disable retries.

func WithShutdown

func WithShutdown(shutdown componenthelper.Shutdown) Option

WithShutdown overrides the default Shutdown function for an exporter. The default shutdown function does nothing and always returns nil.

func WithStart

func WithStart(start componenthelper.Start) Option

WithStart overrides the default Start function for an exporter. The default shutdown function does nothing and always returns nil.

func WithTimeout

func WithTimeout(timeoutSettings TimeoutSettings) Option

WithTimeout overrides the default TimeoutSettings for an exporter. The default TimeoutSettings is 5 seconds.

type PushLogs

type PushLogs func(ctx context.Context, md pdata.Logs) (droppedTimeSeries int, err error)

PushLogs is a helper function that is similar to ConsumeLogs but also returns the number of dropped logs.

type PushMetrics

type PushMetrics func(ctx context.Context, md pdata.Metrics) (droppedTimeSeries int, err error)

PushMetrics is a helper function that is similar to ConsumeMetrics but also returns the number of dropped metrics.

type PushTraces

type PushTraces func(ctx context.Context, td pdata.Traces) (droppedSpans int, err error)

PushTraces is a helper function that is similar to ConsumeTraces but also returns the number of dropped spans.

type QueueSettings

type QueueSettings struct {
	// Enabled indicates whether to not enqueue batches before sending to the consumerSender.
	Enabled bool `mapstructure:"enabled"`
	// NumConsumers is the number of consumers from the queue.
	NumConsumers int `mapstructure:"num_consumers"`
	// QueueSize is the maximum number of batches allowed in queue at a given time.
	QueueSize int `mapstructure:"queue_size"`
}

QueueSettings defines configuration for queueing batches before sending to the consumerSender.

func DefaultQueueSettings

func DefaultQueueSettings() QueueSettings

DefaultQueueSettings returns the default settings for QueueSettings.

type ResourceToTelemetrySettings

type ResourceToTelemetrySettings struct {
	// Enabled indicates whether to not convert resource attributes to metric labels
	Enabled bool `mapstructure:"enabled"`
}

ResourceToTelemetrySettings defines configuration for converting resource attributes to metric labels.

type RetrySettings

type RetrySettings struct {
	// Enabled indicates whether to not retry sending batches in case of export failure.
	Enabled bool `mapstructure:"enabled"`
	// InitialInterval the time to wait after the first failure before retrying.
	InitialInterval time.Duration `mapstructure:"initial_interval"`
	// MaxInterval is the upper bound on backoff interval. Once this value is reached the delay between
	// consecutive retries will always be `MaxInterval`.
	MaxInterval time.Duration `mapstructure:"max_interval"`
	// MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch.
	// Once this value is reached, the data is discarded.
	MaxElapsedTime time.Duration `mapstructure:"max_elapsed_time"`
}

RetrySettings defines configuration for retrying batches in case of export failure. The current supported strategy is exponential backoff.

func DefaultRetrySettings

func DefaultRetrySettings() RetrySettings

DefaultRetrySettings returns the default settings for RetrySettings.

type TimeoutSettings

type TimeoutSettings struct {
	// Timeout is the timeout for every attempt to send data to the backend.
	Timeout time.Duration `mapstructure:"timeout"`
}

ComponentSettings for timeout. The timeout applies to individual attempts to send data to the backend.

func DefaultTimeoutSettings

func DefaultTimeoutSettings() TimeoutSettings

DefaultTimeoutSettings returns the default settings for TimeoutSettings.

Jump to

Keyboard shortcuts

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