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
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
The maximum size of a single write to a broker was previously fixed at
the underlying franz-go default of 100 MiB and could not be configured.
As a result, setting `producer.max_message_bytes` above 100 MiB passed
configuration validation but caused the collector to fail on startup
with an unrecoverable error.
The new `producer.max_broker_write_bytes` setting (default 104857600,
i.e. 100 MiB) exposes this limit. To send messages larger than 100 MiB,
raise it so it is greater than or equal to `max_message_bytes`.
Configuration is now validated up front: the collector reports a clear
error if `max_broker_write_bytes` is below the 100 MiB minimum or
smaller than `max_message_bytes`, rather than failing at runtime.
<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes#47492
<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests.
<!--Describe the documentation added.-->
#### Documentation
Updated the README.md with this new option.
<!--Authorship attestation. See AGENTS.md for details. AI agents must
not check this box on behalf
of the user; the human author must check it themselves before the PR is
ready for review.-->
#### Authorship
- [X] I, a human, wrote this pull request description myself.
<!--Please delete paragraphs that you did not use before submitting.-->
---------
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Copy file name to clipboardExpand all lines: exporter/kafkaexporter/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,7 @@ The following settings can be optionally configured:
105
105
-`requests_per_second` is the average number of requests per seconds.
106
106
-`producer`
107
107
-`max_message_bytes` (default = 1000000) the maximum permitted size of a message in bytes, calculated before compression.
108
+
-`max_broker_write_bytes` (default = 104857600) the maximum bytes the producer will write to a broker in a single request. Must be greater than or equal to `max_message_bytes`. Increase this when raising `max_message_bytes` above 100 MiB.
108
109
-`required_acks` (default = 1) controls when a message is regarded as transmitted. <https://docs.confluent.io/platform/current/installation/configuration/producer-configs.html#acks>
109
110
-`compression` (default = 'none') the compression used when producing messages to kafka. The options are: `none`, `gzip`, `snappy`, `lz4`, and `zstd`<https://docs.confluent.io/platform/current/installation/configuration/producer-configs.html#compression-type>
Copy file name to clipboardExpand all lines: pkg/kafka/configkafka/config.schema.yaml
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -194,8 +194,11 @@ $defs:
194
194
description: Linger controls the linger time for the producer. (default 10ms).
195
195
type: string
196
196
format: duration
197
+
max_broker_write_bytes:
198
+
description: MaxBrokerWriteBytes is the maximum bytes the producer will write to a broker in a single request. It must be >= MaxMessageBytes. Maps to franz-go's kgo.BrokerMaxWriteBytes, whose default (and minimum accepted value) is 100 MiB. (default 104857600)
199
+
type: integer
197
200
max_message_bytes:
198
-
description: Maximum message bytes the producer will accept to produce (default 1000000)
201
+
description: MaxMessageBytes is the maximum message bytes the producer will accept to produce. It must be less than or equal to MaxBrokerWriteBytes, and must fit in an int32 as it maps to franz-go's kgo.ProducerBatchMaxBytes. (default 1000000)
199
202
type: integer
200
203
required_acks:
201
204
description: 'RequiredAcks holds the number acknowledgements required before producing returns successfully. See: https://docs.confluent.io/platform/current/installation/configuration/producer-configs.html#acks Acceptable values are: 0 (NoResponse) Does not wait for any acknowledgements. 1 (WaitForLocal) Waits for only the leader to write the record to its local log, but does not wait for followers to acknowledge. (default) -1 (WaitForAll) Waits for all in-sync replicas to acknowledge. In YAML configuration, "all" is accepted as an alias for -1.'
expectedErr: "max_message_bytes (-1000) must be non-negative",
315
326
},
327
+
"max_broker_write_bytes_negative": {
328
+
expectedErr: "max_broker_write_bytes (-1000) must be non-negative",
329
+
},
330
+
"max_broker_write_bytes_too_small": {
331
+
expectedErr: fmt.Sprintf("max_broker_write_bytes (1000) must be at least %d (%d MiB, franz-go minimum)", franzGoMinBrokerWriteBytes, franzGoMinBrokerWriteBytes>>20),
332
+
},
333
+
"max_message_bytes_exceeds_broker": {
334
+
expectedErr: fmt.Sprintf("max_message_bytes (209715200) cannot be greater than max_broker_write_bytes (%d)", franzGoMinBrokerWriteBytes),
335
+
},
336
+
})
337
+
}
338
+
339
+
// TestProducerConfigInt32Overflow verifies that size limits exceeding the int32
340
+
// range used by franz-go are rejected. Values above math.MaxInt32 are only
341
+
// representable on platforms where int is 64-bit, so this is skipped elsewhere.
0 commit comments