You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kafkaexporter: Allow topics from metadata key (#40154)
#### Description
Introduces a new per-signal config option `topic_from_metadata_key` to
allow the user to produce to topics which which can be set using parts
of the request metadata. This is useful for multi-tenant use-cases.
<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Closes#39208
<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests
<!--Describe the documentation added.-->
#### Documentation
Updated the readme with the new option.
---------
Signed-off-by: Marc Lopez Rubio <[email protected]>
Copy file name to clipboardExpand all lines: exporter/kafkaexporter/README.md
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -30,12 +30,15 @@ The following settings can be optionally configured:
30
30
-`logs`
31
31
-`topic` (default = otlp\_logs): The name of the Kafka topic to which logs will be exported.
32
32
-`encoding` (default = otlp\_proto): The encoding for logs. See [Supported encodings](#supported-encodings).
33
+
-`topic_from_metadata_key` (default = ""): The name of the metadata key whose value should be used as the message's topic. Useful to dynamically produce to topics based on request inputs. It takes precedence over `topic_from_attribute` and `topic` settings.
33
34
-`metrics`
34
35
-`topic` (default = otlp\_metrics): The name of the Kafka topic from which to consume metrics.
35
36
-`encoding` (default = otlp\_proto): The encoding for metrics. See [Supported encodings](#supported-encodings).
37
+
-`topic_from_metadata_key` (default = ""): The name of the metadata key whose value should be used as the message's topic. Useful to dynamically produce to topics based on request inputs. It takes precedence over `topic_from_attribute` and `topic` settings.
36
38
-`traces`
37
39
-`topic` (default = otlp\_spans): The name of the Kafka topic from which to consume traces.
38
40
-`encoding` (default = otlp\_proto): The encoding for traces. See [Supported encodings](#supported-encodings).
41
+
-`topic_from_metadata_key` (default = ""): The name of the metadata key whose value should be used as the message's topic. Useful to dynamically produce to topics based on request inputs. It takes precedence over `topic_from_attribute` and `topic` settings.
39
42
-`topic` (Deprecated in v0.124.0: use `logs::topic`, `metrics::topic`, and `traces::topic`) If specified, this is used as the default topic, but will be overridden by signal-specific configuration. See [Destination Topic](#destination-topic) below for more details.
40
43
-`topic_from_attribute` (default = ""): Specify the resource attribute whose value should be used as the message's topic. See [Destination Topic](#destination-topic) below for more details.
41
44
-`encoding` (Deprecated in v0.124.0: use `logs::encoding`, `metrics::encoding`, and `traces::encoding`) If specified, this is used as the default encoding, but will be overridden by signal-specific configuration. See [Supported encodings](#supported-encodings) below for more details.
@@ -139,6 +142,7 @@ exporters:
139
142
140
143
The destination topic can be defined in a few different ways and takes priority in the following order:
141
144
142
-
1. When `topic_from_attribute` is configured, and the corresponding attribute is found on the ingested data, the value of this attribute is used.
143
-
2. If a prior component in the collector pipeline sets the topic on the context via the `topic.WithTopic` function (from the `github.com/open-telemetry/opentelemetry-collector-contrib/pkg/kafka/topic` package), the value set in the context is used.
144
-
3. Finally, the `<signal>::topic` configuration is used for the signal-specific destination topic. If this is not explicitly configured, the `topic` configuration (deprecated in v0.124.0) is used as a fallback for all signals.
145
+
1. When `<signal>.topic_from_metadata_key` is set to use a key from the request metadata, the value of this key is used as the signal specific topic.
146
+
2. Otherwise, if `topic_from_attribute` is configured, and the corresponding attribute is found on the ingested data, the value of this attribute is used.
147
+
3. If a prior component in the collector pipeline sets the topic on the context via the `topic.WithTopic` function (from the `github.com/open-telemetry/opentelemetry-collector-contrib/pkg/kafka/topic` package), the value set in the context is used.
148
+
4. Finally, the `<signal>::topic` configuration is used for the signal-specific destination topic. If this is not explicitly configured, the `topic` configuration (deprecated in v0.124.0) is used as a fallback for all signals.
0 commit comments