Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporterhelper] Add an ability to batch by a key from pdata or context #10825

Open
Tracked by #8122
dmitryax opened this issue Aug 7, 2024 · 1 comment
Open
Tracked by #8122

Comments

@dmitryax
Copy link
Member

dmitryax commented Aug 7, 2024

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

@sfc-gh-sili
Copy link
Contributor

I can take a look at this issue. @dmitryax Would you mind assigning to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants