Skip to content

[exporter/opensearchexporter] Prevent dotted-attribute mapping conflicts - #50953

Draft
singhvibhanshu wants to merge 1 commit into
open-telemetry:mainfrom
singhvibhanshu:fix/47465
Draft

[exporter/opensearchexporter] Prevent dotted-attribute mapping conflicts#50953
singhvibhanshu wants to merge 1 commit into
open-telemetry:mainfrom
singhvibhanshu:fix/47465

Conversation

@singhvibhanshu

Copy link
Copy Markdown
Member

Description

This PR prevents dotted-attribute mapping conflicts in the OpenSearch exporter.

OpenSearch expands dots in JSON field names into nested objects during dynamic mapping. OTel attributes are a flat namespace, so an attribute map containing both a concrete key (e.g. code.function) and a longer key that uses it as an object prefix (e.g. code.function.name) made OpenSearch try to map attributes.code.function as both a value and an object, rejecting the document with a mapper_parsing_exception. This commonly happens while migrating between semantic-convention versions.

The conflict is resolved in two complementary ways:

  • The conflicting concrete value is always relocated under a .value sub-key (code.function becomes code.function.value) for span, event, link, log-record, metric data-point, exemplar and instrumentation-scope attributes in the ss4o and otel-v1 mapping modes. Only documents OpenSearch would otherwise reject are changed.
  • mapping.manage_index_template is now supported in ss4o mode, installing traces and logs index templates that map attribute bags as flat_object so OpenSearch stops expanding dotted attribute keys. This deterministically avoids conflicts across documents. Since flat_object indexes values as strings, the option is opt-in and defaults to false.

Link to tracking issue

Fixes #47465

Testing

Tuned.

Documentation

Tuned.

Authorship

  • I, a human, wrote this pull request description myself.

Signed-off-by: singhvibhanshu <find.vibhanshu@gmail.com>
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

Successfully merging this pull request may close these issues.

[opensearch] Error emitting telemetry in PHP with otel-collector

1 participant