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
[exporter/kafka] Add record_headers config to set static headers on outgoing records (#47201)
## Description
Resolves#47193
This PR adds a new `record_headers` configuration option to the Kafka
exporter
**Changes made:**
* added `record_headers` to `Config` struct
* updated `makeFranzMessages` in the `franz-go` client wrapper to
iterate over the configured map and append them as `kgo.RecordHeader` to
the outgoing messages
* added `TestMakeFranzMessages_RecordHeaders` to verify headers are
successfully attached, bringing test suite to 147 passing tests
* documented the new field and provided an example in the `README.md`
* added `.chloggen/fix-47193.yaml`
## Testing
- [x] added `TestMakeFranzMessages_RecordHeaders`
- [x] all 147 tests passed locally
---------
Signed-off-by: singhvibhanshu <singhvibhanshu@hotmail.com>
Copy file name to clipboardExpand all lines: exporter/kafkaexporter/README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,7 @@ The following settings can be optionally configured:
48
48
-`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.
49
49
-`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.
50
50
-`include_metadata_keys` (default = []): Specifies a list of metadata keys to propagate as Kafka message headers. If one or more keys aren't found in the metadata, they are ignored. When `sending_queue::batch` is enabled, `sending_queue::batch::partition::metadata_keys` must be configured and include all values configured in `include_metadata_keys`.
51
+
-`record_headers` (default = {}): Specifies a map of key/value pairs to set as static headers on every outgoing Kafka record.
51
52
-`partition_traces_by_id` (default = false): configures the exporter to include the trace ID as the message key in trace messages sent to kafka. *Please note:* this setting does not have any effect on Jaeger encoding exporters since Jaeger exporters include trace ID as the message key by default.
52
53
-`partition_metrics_by_resource_attributes` (default = false) configures the exporter to include the hash of sorted resource attributes as the message partitioning key in metric messages sent to kafka.
53
54
-`partition_logs_by_resource_attributes` (default = false) configures the exporter to include the hash of sorted resource attributes as the message partitioning key in log messages sent to kafka.
description: RecordPartitioner configures how Kafka records are assigned to partitions. The default ("sarama_compatible") retains the legacy Sarama-compatible hashing behavior. Set to "sticky", "round_robin", or "least_backup" to use one of the built-in franz-go partitioners, or "extension" to delegate to a custom extension.
0 commit comments