Skip to content

[exporter/elasticsearch] Sort and deduplicate attributes for metrics grouping #38083

@carsonip

Description

@carsonip

Component(s)

exporter/elasticsearch

What happened?

Description

ECS and OTel mapping modes implement metrics grouping. They hash the attributes in the order as they are in the attribute maps. However, in the edge case where 2 set of attributes have the same key value pairs but in different orders, they will generate different hash, which will in turn create 2 documents for the same set of dimensions, resulting in version_conflict_engine_exception from TSDB.

OTel mode attributes need to be sorted. ECS mode attributes need to be sorted and deduplicated as attributes at different level are all propagated up to the top level.

Steps to Reproduce

Expected Result

Actual Result

Collector version

v0.120.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

Log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions