[exporter/elasticsearch] Dynamically route documents by default#38500
Conversation
| Telemetry data will be written to signal specific data streams by default: | ||
| logs to `logs-generic-default`, metrics to `metrics-generic-default`, and traces to `traces-generic-default`. | ||
| Documents are routed to the target index / data stream dynamically in the following order. The first routing mode that applies will be used. | ||
| 1. "Static mode": To `logs_index` (for log records), `metrics_index` (for data points) and `traces_index` (for spans and span events) if they are configured. |
There was a problem hiding this comment.
Should we use logs_index for span events? Or maybe add another option for span events?
There was a problem hiding this comment.
It isn't intuitive to have logs_index as the configuration of destination of span events. What about a new config traces_span_events_index (that is only applicable to otel mapping mode as it sends span events as separate documents)? It should default to empty, such that dynamic routing kicks in.
I have also considered
- using
logs_indexfor span events. See reasoning below. - setting the default of
traces_span_events_indexaslogs_index, but it seems to a big trap. Let's imagine if a user wants logs to be statically routed to anlogs_indexand traces dynamically routed. If the user sets logs_index, span events suddenly are not dynamically routed. This is not great.
There was a problem hiding this comment.
As we model span events as logs in OTel mode, I think it's only logical to use logs_index. Ack that this may not be intuitive but documenting this seems like the solution. I think we should start simple by just using logs_index and only adding something like traces_span_events_index if necessary.
There was a problem hiding this comment.
sgtm. It is explicitly stated that it is not recommended to set logs_index, metrics_index and traces_index anyway.
axw
left a comment
There was a problem hiding this comment.
Thank you, this is a nice simplification.
| Telemetry data will be written to signal specific data streams by default: | ||
| logs to `logs-generic-default`, metrics to `metrics-generic-default`, and traces to `traces-generic-default`. | ||
| Documents are statically or dynamically routed to the target index / data stream in the following order. The first routing mode that applies will be used. | ||
| 1. "Static mode": To `logs_index` for log records, `metrics_index` for data points and `traces_index` for spans, if these configs are not empty respectively. In OTel mapping mode (`mapping::mode: otel`), span events are separate documents routed to `logs_index` if non-empty. |
There was a problem hiding this comment.
Perhaps instead of repeating the statement about otel mode span events, add a paragraph after the numbered list mentioning that in otel mode, span events are considered log records and routed as such?
…8458) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Breaking change: change default `mapping::mode` config to `otel` for the best user experience and the most intuitive document structure in Elasticsearch. See README to learn more about otel mapping mode. To retain the old behavior, explicitly set `mapping::mode` to `none`. Should be released together with #38500 <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #37241 <!--Describe the documentation added.--> #### Documentation Updated README
Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
|
@JaredTan95 any thoughts on it? |
JaredTan95
left a comment
There was a problem hiding this comment.
This is great, dynamic routing is more flexible and logically consistent
Description
Breaking change.
Overhaul in document routing. New document routing logic:
Effective changes:
{logs,metrics,traces}_dynamic_indexconfig no-op{logs,metrics,traces}_dynamic_index::enabledand{logs,metrics,traces}_indexset at the same time, as users who rely on dynamic index should not set{logs,metrics,traces}_index.elasticsearch.index.{prefix,suffix}handling. Replace it withelasticsearch.indexhandling that uses attribute value as index directly. Users rely on the previously supportedelasticsearch.index.prefixandelasticsearch.index.suffixshould migrate to a transform processor that setselasticsearch.index.Should be released together with #38458
Link to tracking issue
Fixes #38361
Testing
Documentation