Fix issues #43183 & #42585: opensearch exporter dynamic log index feature puts logs in wrong index & support multiple placeholders
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
Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.
Important reminders:
- Please review our Contributing Guidelines.
- Don't forget to sign the Contributor License Agreement (CLA) if you haven't already.
A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!
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
@ps48 please review as codeowner
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 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.
Fixed workflow Lint issues.
Approved by code-owners and @MovieStoreGuy already. It can be merged once CI passes.
@Confushion it seems there are still some lint errors.