Skip to content

Commit 769edb2

Browse files
committed
Address review comments
1 parent 5c9c85a commit 769edb2

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

exporter/elasticsearchexporter/README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,17 @@ Using the common `batcher` functionality provides several benefits over the defa
119119
### Elasticsearch document routing
120120

121121
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.
122-
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.
123-
2. "Dynamic - Index attribute mode": To index name in `elasticsearch.index` attribute (precedence: log record / data point / span attribute [^3] > scope attribute > resource attribute) if the attribute exists. In OTel mapping mode (`mapping::mode: otel`), span events are separate documents routed according to span events attributes, not span attributes.
122+
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. [^3]
123+
2. "Dynamic - Index attribute mode": To index name in `elasticsearch.index` attribute (precedence: log record / data point / span attribute > scope attribute > resource attribute) if the attribute exists. [^3]
124124
3. "Dynamic - Data stream routing mode": To data stream constructed from `${data_stream.type}-${data_stream.dataset}-${data_stream.namespace}`,
125-
where `data_stream.type` is `logs` for log records, `metrics` for data points, and `traces` for spans.
126-
In OTel mapping mode (`mapping::mode: otel`), span events are separate documents that have `data_stream.type: logs` and are routed using span event attributes, not span attributes.
127-
Note that in OTel mapping mode, `data_stream.dataset` will always be appended with `.otel`.
125+
where `data_stream.type` is `logs` for log records, `metrics` for data points, and `traces` for spans, and is static. [^3]
128126
In a special case with `mapping::mode: bodymap`, `data_stream.type` field (valid values: `logs`, `metrics`) can be dynamically set from attributes.
129-
The resulting docs will contain the corresponding `data_stream.*` fields, see restrictions applied to [Data Stream Fields](https://www.elastic.co/guide/en/ecs/current/ecs-data_stream.html).
130-
1. `data_stream.dataset` or `data_stream.namespace` in attributes (precedence: log record / data point / span attribute [^3] > scope attribute > resource attribute)
127+
The resulting documents will contain the corresponding `data_stream.*` fields, see restrictions applied to [Data Stream Fields](https://www.elastic.co/guide/en/ecs/current/ecs-data_stream.html).
128+
1. `data_stream.dataset` or `data_stream.namespace` in attributes (precedence: log record / data point / span attribute > scope attribute > resource attribute)
131129
2. Otherwise, if scope name matches regex `/receiver/(\w*receiver)`, `data_stream.dataset` will be capture group #1
132130
3. Otherwise, `data_stream.dataset` falls back to `generic` and `data_stream.namespace` falls back to `default`.
133131

134-
[^3]: Additionally, span event attribute in OTel mode
132+
[^3]: See additional handling in [Document routing exceptions for OTel data mode](#document-routing-exceptions-for-otel-data-mode)
135133

136134
This can be customised through the following settings:
137135

@@ -160,6 +158,16 @@ This can be customised through the following settings:
160158
- `logs_dynamic_id` (optional): Dynamically determines the document ID to be used in Elasticsearch based on a log record attribute.
161159
- `enabled`(default=false): Enable/Disable dynamic ID for log records. If `elasticsearch.document_id` exists and is not an empty string in the log record attributes, it will be used as the document ID. Otherwise, the document ID will be generated by Elasticsearch. The attribute `elasticsearch.document_id` is removed from the final document. See [Setting a document id dynamically](#setting-a-document-id-dynamically).
162160

161+
#### Document routing exceptions for OTel data mode
162+
163+
In OTel mapping mode (`mapping::mode: otel`), there are certain exceptions to the above document routing rules in [Elasticsearch document routing](#elasticsearch-document-routing).
164+
165+
1. "Static mode": span events are separate documents routed to `logs_index` if non-empty.
166+
2. "Dynamic - Index attribute mode": span events are separate documents routed using attribute (precedence: span event attribute > scope attribute > resource attribute)
167+
3. "Dynamic - Data stream routing mode": Span events are separate documents that have `data_stream.type: logs` and are routed using attribute (precedence: span event attribute > scope attribute > resource attribute)
168+
For all documents, `data_stream.dataset` will always be appended with `.otel`.
169+
170+
163171
### Elasticsearch document mapping
164172

165173
The Elasticsearch exporter supports several document schemas and preprocessing

exporter/elasticsearchexporter/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ type LogstashFormatSettings struct {
117117
type DynamicIndexSetting struct {
118118
// Enabled enables dynamic index routing.
119119
//
120-
// Deprecated: This config is now ignored. Dynamic index routing is always done by default.
120+
// Deprecated: [v0.122.0] This config is now ignored. Dynamic index routing is always done by default.
121121
Enabled bool `mapstructure:"enabled"`
122122
}
123123

0 commit comments

Comments
 (0)