Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/elasticsearch] Implement receiver-based routing under *_dynamic_index config #35417

Merged
merged 4 commits into from
Sep 30, 2024

Conversation

carsonip
Copy link
Contributor

@carsonip carsonip commented Sep 25, 2024

Description:

Implement receiver-based routing under *_dynamic_index config.

e.g. Set data_stream.dataset to hostmetricsreceiver (or hostmetricsreceiver.otel in the OTel output mode) for the scope name github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/cpuscraper

Link to tracking Issue:
Fixes #34246

Testing:

Documentation:

@carsonip carsonip changed the title [exporter/elasticsearch] Add receiver-based routing [exporter/elasticsearch] Implement receiver-based routing under *_dynamic_index config Sep 25, 2024
@carsonip carsonip marked this pull request as ready for review September 25, 2024 13:46
@carsonip carsonip requested a review from a team as a code owner September 25, 2024 13:46
@@ -121,21 +121,21 @@ This can be customised through the following settings:

- `logs_dynamic_index` (optional): uses resource, scope, or log record attributes to dynamically construct index name.
- `enabled`(default=false): Enable/Disable dynamic index for log records. If `data_stream.dataset` or `data_stream.namespace` exist in attributes (precedence: log record attribute > scope attribute > resource attribute), they will be used to dynamically construct index name in the form `logs-${data_stream.dataset}-${data_stream.namespace}`. Otherwise, if
`elasticsearch.index.prefix` or `elasticsearch.index.suffix` exist in attributes (precedence: resource attribute > scope attribute > log record attribute), they will be used to dynamically construct index name in the form `${elasticsearch.index.prefix}${logs_index}${elasticsearch.index.suffix}`. Otherwise, the index name falls back to `logs-generic-default`, and `logs_index` config will be ignored. Except for prefix/suffix attribute presence, the resulting docs will contain the corresponding `data_stream.*` fields.
`elasticsearch.index.prefix` or `elasticsearch.index.suffix` exist in attributes (precedence: resource attribute > scope attribute > log record attribute), they will be used to dynamically construct index name in the form `${elasticsearch.index.prefix}${logs_index}${elasticsearch.index.suffix}`. Otherwise, if scope name matches regex `/receiver/(\w*receiver)`, `data_stream.dataset` will be capture group #1. Otherwise, the index name falls back to `logs-generic-default`, and `logs_index` config will be ignored. Except for prefix/suffix attribute presence, the resulting docs will contain the corresponding `data_stream.*` fields.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will change the way data is routed for users who have enabled a (logs|metrics|traces)_dynamic_index property. Previously, e.g. metrics from the Host Metrics receiver were sent to metrics-generic-default. After this change, they will be sent to metrics-hostmetrics-default, correct? This could potentially break a user's setup, assuming they have e.g. some alerts set up querying for host metrics from the metrics-generic-default data stream?

Perhaps we should change the changelog entry's change_type from enhancement to breaking?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to breaking

@andrzej-stencel andrzej-stencel merged commit 2225ccc into open-telemetry:main Sep 30, 2024
156 checks passed
@github-actions github-actions bot added this to the next release milestone Sep 30, 2024
jriguera pushed a commit to springernature/opentelemetry-collector-contrib that referenced this pull request Oct 4, 2024
…amic_index config (open-telemetry#35417)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
Implement receiver-based routing under *_dynamic_index config.

e.g. Set data_stream.dataset to hostmetricsreceiver (or
hostmetricsreceiver.otel in the OTel output mode) for the scope name
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/cpuscraper

**Link to tracking Issue:** <Issue number if applicable>
Fixes open-telemetry#34246

**Testing:** <Describe what testing was performed and which tests were
added.>

**Documentation:** <Describe the documentation added.>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default routing to receiver-specific data streams
5 participants