exporterbatcher

package
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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchMergeFunc

type BatchMergeFunc[T any] func(context.Context, T, T) (T, error)

BatchMergeFunc is a function that merges two requests into a single request. Do not mutate the requests passed to the function if error can be returned after mutation or if the exporter is marked as not mutable. Experimental: This API is at the early stage of development and may change without backward compatibility until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.

type BatchMergeSplitFunc

type BatchMergeSplitFunc[T any] func(ctx context.Context, cfg MaxSizeConfig, optionalReq T, req T) ([]T, error)

BatchMergeSplitFunc is a function that merge and/or splits one or two requests into multiple requests based on the configured limit provided in MaxSizeConfig. All the returned requests MUST have a number of items that does not exceed the maximum number of items. Size of the last returned request MUST be less or equal than the size of any other returned request. The original request MUST not be mutated if error is returned after mutation or if the exporter is marked as not mutable. The length of the returned slice MUST not be 0. The optionalReq argument can be nil, make sure to check it before using. Experimental: This API is at the early stage of development and may change without backward compatibility until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.

type Config

type Config struct {
	// Enabled indicates whether to not enqueue batches before sending to the consumerSender.
	Enabled bool `mapstructure:"enabled"`

	// FlushTimeout sets the time after which a batch will be sent regardless of its size.
	FlushTimeout time.Duration `mapstructure:"flush_timeout"`

	MinSizeConfig `mapstructure:",squash"`
	MaxSizeConfig `mapstructure:",squash"`
}

Config defines a configuration for batching requests based on a timeout and a minimum number of items. MaxSizeItems defines batch splitting functionality if it's more than zero. Experimental: This API is at the early stage of development and may change without backward compatibility until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.

func NewDefaultConfig

func NewDefaultConfig() Config

func (Config) Validate

func (c Config) Validate() error

type MaxSizeConfig

type MaxSizeConfig struct {
	// MaxSizeItems is the maximum number of the batch items, i.e. spans, data points or log records for OTLP.
	// If the batch size exceeds this value, it will be broken up into smaller batches if possible.
	// Setting this value to zero disables the maximum size limit.
	MaxSizeItems int `mapstructure:"max_size_items"`
}

MaxSizeConfig defines the configuration for the maximum number of items in a batch. Experimental: This API is at the early stage of development and may change without backward compatibility until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.

type MinSizeConfig

type MinSizeConfig struct {
	// MinSizeItems is the number of items (spans, data points or log records for OTLP) at which the batch should be
	// sent regardless of the timeout. There is no guarantee that the batch size always greater than this value.
	// This option requires the Request to implement RequestItemsCounter interface. Otherwise, it will be ignored.
	MinSizeItems int `mapstructure:"min_size_items"`
}

MinSizeConfig defines the configuration for the minimum number of items in a batch. Experimental: This API is at the early stage of development and may change without backward compatibility until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.

Jump to

Keyboard shortcuts

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