opentelemetry-collector-contrib icon indicating copy to clipboard operation
opentelemetry-collector-contrib copied to clipboard

Fix issues #43183 & #42585: opensearch exporter dynamic log index feature puts logs in wrong index & support multiple placeholders

Open Confushion opened this issue 1 month ago • 4 comments

Description

  • Modified the OpenSearch exporter to resolve index names per span/log record instead of per resource, using the specified attribute precedence (item > scope > resource). The changes ensure that each individual span or log record can be indexed into a different index based on its attributes, while maintaining backward compatibility for default configurations.

  • Added support for multiple placeholders in index names. This enhances flexibility for dynamic indexing based on multiple attributes, enabling more granular index naming strategies.

Link to tracking issue

  • Fixes #43183
  • Fixes #42585

Testing

  • Update tests to use new per-item methods and verify precedence
  • Added tests for multiple placeholder resolution and fallback behavior

Documentation

  • Update documentation with examples of multiple placeholder usage

Confushion avatar Nov 08 '25 15:11 Confushion

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!

github-actions[bot] avatar Nov 08 '25 15:11 github-actions[bot]

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: Confushion / name: Menno van Gangelen (d52643b1308e9f6db13dea5d6203a9e4cb3a650f)

Updated PR: Modified the OpenSearch exporter to resolve index names per span/log record instead of per resource, using the specified attribute precedence (item > scope > resource). The changes ensure that each individual span or log record can be indexed into a different index based on its attributes, while maintaining backward compatibility for default configurations.

Added support for multiple placeholders in index names. This enhances flexibility for dynamic indexing based on multiple attributes, enabling more granular index naming strategies.

Fixes #43183 and #42585

Confushion avatar Nov 15 '25 00:11 Confushion

@ps48 please review as codeowner

atoulme avatar Nov 27 '25 08:11 atoulme

This is a great contribution thanks @Confushion! Have some questions/suggestions for some of the changes.

cc: @atoulme @MovieStoreGuy @songy23

All suggestions have been implemented.

Confushion avatar Dec 15 '25 23:12 Confushion

@Confushion thanks for responding to all the questions and implementing the suggestions 🙏🏽 This is really a great feature contribution for the OS exporter. @MovieStoreGuy @songy23 can you please help run the workflows and merge this PR.

ps48 avatar Dec 16 '25 06:12 ps48

Fixed workflow Lint issues.

Confushion avatar Dec 16 '25 22:12 Confushion

Approved by code-owners and @MovieStoreGuy already. It can be merged once CI passes.

ChrsMark avatar Dec 18 '25 07:12 ChrsMark

@Confushion it seems there are still some lint errors.

ChrsMark avatar Dec 18 '25 08:12 ChrsMark