Description
Introduce a new exporterhelper.BatcherOption
with the following signature:
func WithBatchIdentifier(f IdentifyBatchFunc, batchIdentifiersLimit int) BatcherOption`
where
// IdentifyBatchFunc returns an identifier for a batch. This function can be used to separate particular
// Requests into different batches. Batches with different identifiers will not be merged together.
// Provided context can be used to extract information from the context and use it as a part of the identifier as well.
type IdentifyBatchFunc func(ctx context.Context, r Request) string
batchIdentifiersLimit
defines a maximum number of allowed identifiers. Requests producing batch identifiers that exceed this limit will be dropped. If this value is zero, then there is no limit on the number of identifiers.
The naming can be changed. The idea is that we need to provide exporters with a way to produce different batches based on some custom string key taken from the Request
of context. This API would allow us to replicate the metadata_keys
option in the batch processor, see https://github.com/open-telemetry/opentelemetry-collector/blob/main/processor/batchprocessor/README.md#batching-and-client-metadata.
Initial version of the exporter batch that includes this functionality can be found in 5d662b6