consumerretry

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogs

func NewLogs(config Config, logger *zap.Logger, next consumer.Logs) consumer.Logs

Types

type Config

type Config struct {
	// Enabled indicates whether to not retry sending logs in case of receiving a retryable error from a downstream
	// consumer. Default is false.
	Enabled bool `mapstructure:"enabled"`
	// InitialInterval the time to wait after the first failure before retrying. Default value is 1 second.
	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`. Default value is 30 seconds.
	MaxInterval time.Duration `mapstructure:"max_interval"`
	// MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a logs batch to
	// a downstream consumer. Once this value is reached, the data is discarded. It never stops if MaxElapsedTime == 0.
	// Default value is 5 minutes.
	MaxElapsedTime time.Duration `mapstructure:"max_elapsed_time"`
}

Config defines configuration for retrying batches in case of receiving a retryable error from a downstream consumer. If the retryable error doesn't provide a delay, exponential backoff is applied.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig returns the default Config.

type MockLogsRejecter

type MockLogsRejecter struct {
	consumertest.LogsSink
	// contains filtered or unexported fields
}

func NewMockLogsRejecter

func NewMockLogsRejecter(acceptAfter int32) *MockLogsRejecter

NewMockLogsRejecter creates new MockLogsRejecter. acceptAfter is a number of rejects before accepting, 0 means always accept, -1 means always reject with permanent error

func (*MockLogsRejecter) ConsumeLogs

func (m *MockLogsRejecter) ConsumeLogs(ctx context.Context, logs plog.Logs) error

Jump to

Keyboard shortcuts

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