open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.71k stars 2.14k forks source link

[exporter/elasticsearch] Group metrics in documents based on timestamp and attributes #33756

Open andrzej-stencel opened 4 days ago

andrzej-stencel commented 4 days ago

Component(s)

exporter/elasticsearch

Is your feature request related to a problem? Please describe.

As implemented in https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/33755, metrics are exported to Elasticsearch so that a separate Elasticsearch document is created for each metric data point. We could improve the performance by grouping metrics that share the timestamp and the set of attributes in one document. For example, the following three metrics:

system.cpu.load_average.1m
system.cpu.load_average.5m
system.cpu.load_average.15m

are currently sent in three separate documents, but they could be sent in one document.

Describe the solution you'd like

Instead of sending each metric data point in a separate document, let's group the metrics that share the timestamp and attributes.

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 4 days ago

Pinging code owners:

strawgate commented 2 days ago

Here was the implementation of metric merging we used in the initial metrics exporter POC https://github.com/strawgate/opentelemetry-collector-contrib/commit/5d1c3ff65f041967cca233b3a10ce62e4d0f17ed