Repository navigation
Description
Context & Problem
We are deploying OpenMeter on Kubernetes via the Helm chart (kafka.enabled: false, pointing config.ingest.kafka and config.sink.kafka at an external managed Kafka cluster) on Alibaba Cloud (Aliyun).
Aliyun's managed Kafka service (ApsaraMQ for Kafka) currently offers Apache Kafka 2.6.2 as its highest supported broker version, with no near-term upgrade path to 2.8+ or 3.x.
When deploying OpenMeter against a Kafka 2.6.2 broker, the confluent-kafka-go (librdkafka) components work out of the box, but the Watermill event bus (IBM/sarama) fails to connect on startup:
kafka: client has run out of available brokers to talk to: EOF
Root Cause
OpenMeter uses two Kafka client libraries:
-
confluent-kafka-go/v2(librdkafka v2.16.0) (used for ingest, sink-worker, and topic provisioning):- Uses
api.version.request = trueby default and dynamically negotiates protocol versions with the2.6.2broker. - Consumer features used by OpenMeter (
cooperative-stickyassignment added in Kafka 2.4, static membershipgroup.instance.idadded in Kafka 2.3) are natively supported by Kafka2.6.2.
- Uses
-
IBM/sarama v1.61.1(used viawatermill-kafka/v3inopenmeter/watermill/driver/kafka/broker.go):createKafkaConfigcallssarama.NewConfig(), which defaultsconfig.Versiontosarama.V2_8_0_0(2.8.0.0), and setsconfig.ApiVersionsRequest = false.- At
V2_8_0_0, Sarama sends protocol request versions introduced in Kafka 2.7/2.8 (such asMetadataRequestv10,ProduceRequestv9,FetchRequestv12, andListOffsetsRequestv6). - A Kafka
2.6.2broker only supports up toMetadatav9,Producev8,Fetchv11, andListOffsetsv5, causing the broker to reject the requests.
Evidence & Local Verification
We tested OpenMeter against a local Apache Kafka 2.6.2 broker (kafka_2.13-2.6.2):
- With the current default (
sarama.V2_8_0_0):sarama.NewClientimmediately fails withkafka: client has run out of available brokers to talk to: EOF. - With
config.Version = sarama.V2_6_2_0inopenmeter/watermill/driver/kafka/broker.go:TopicProvisioner(confluent-kafka-goAdminClient) creates topics as expected.- Watermill
NewPublisherandNewSubscriber(IBM/sarama) connect, publish messages with partition keys, join consumer groups, and consume/ack messages without error. - Ingest producer and sink-worker consumer (
confluent-kafka-gowithcooperative-sticky) produce and consume events end-to-end. - Note:
sarama.V2_6_2_0(Metadatav9,Producev8,Fetchv11) is also above the Kafka 4.0 minimum client protocol baseline (KIP-896 requires Kafka 2.1+), so it remains compatible with Kafka 3.x and 4.x brokers.
Proposed Solution
Either of the following (or both) would unblock Helm deployments against Kafka 2.6.2:
-
Lower the default Sarama protocol version in
openmeter/watermill/driver/kafka/broker.go:func (o *BrokerOptions) createKafkaConfig(role string) (*sarama.Config, error) { config := sarama.NewConfig() config.Version = sarama.V2_6_2_0
Since OpenMeter's Watermill driver does not use any Kafka 2.7/2.8-specific protocol fields,
V2_6_2_0works across Kafka2.6.2through4.x. -
Or make the Kafka protocol version configurable in
KafkaConfiguration(e.g.ingest.kafka.versioninconfig.yaml/ Helmvalues.yamlunderconfig.ingest.kafka.version), parsed viasarama.ParseKafkaVersion(...)and defaulting tosarama.V2_8_0_0(orsarama.V2_6_2_0).
Activity
ToniAdreal commentedon Oct 28, 2026
Verified the diagnosis against current main, and it holds end to end — with two scoping notes that may help pick between the two proposed fixes:
Single choke point.
openmeter/watermill/driver/kafka/broker.go:createKafkaConfigis the onlysarama.NewConfig()call site I found in the repo, and both the Watermill publisher (publisher.go:33) and subscriber (subscriber.go:46) go through it, so pinning the version there covers both directions. It never setsconfig.Version, so it inherits Sarama'sDefaultVersion = V2_8_0_0(IBM/saramautils.go, go.mod pins v1.61.1).The disabled negotiation is the second half of the failure, not just the high default.
createKafkaConfigsetsconfig.ApiVersionsRequest = false(with a comment about ApiVersionsRequest V3 errors flooding logs), so the client cannot discover the broker is 2.6 and downgrade on its own — the configured version becomes a hard ceiling. That also means re-enabling negotiation is not a clean alternative here; lowering the version is.Option 2 (a configurable version) is a bigger change than it looks: there is no version field anywhere in the Kafka config plumbing —
pkg/kafka/config.go'sCommonConfigParamshas no Version, andapp/config/kafka.go'sConfigureKafkaConfigurationsets nokafka.versiondefault — so it needs a new field plus a viper default plus plumbing intoBrokerOptions, whereas option 1 is a one-line change increateKafkaConfig. If the goal is just to unblock 2.6 brokers, I'd start with option 1 (V2_6_2_0, which Sarama defines) and treat configurability as a follow-up.No blocker from me on option 1. (Verification here is source-level against current main; the Kafka 2.6 broker run in the issue body is the reporter's, not mine.)
mvanhorn commentedon Nov 13, 2026
The shared Sarama config never set a protocol version, so it kept the library default of 2.8.0 and sent request versions a 2.6.2 broker rejects. ApiVersions negotiation is turned off, so the client cannot discover the broker and step down; the configured version is a hard ceiling the broker must accept.
createKafkaConfig now pins the Sarama protocol version to 2.6.2, which that broker supports and which 3.x and 4.x brokers still accept.
#5513
jedi-tal commentedon Nov 16, 2026
Same root cause breaks Redpanda too, and pinning 2.6.2 (#5513) wouldn't fix it there
We hit this running OpenMeter
v1.0.0-beta.236against Redpandav26.2.6as the Kafka API. It matches this issue: theconfluent-kafka-gocomponents (ingest, sink-worker) work, because librdkafka negotiates versions. The Watermill/Sarama consumers (balance-worker, notification-service, billing-worker) never join their consumer group:Error while processing request from <client> - Unsupported version 7 for join_group APIand closes the connection: about 31k rejections in 4 hours.Group consume errorwithEOFseveral times a second. In our deployment the retry loop also grew the workers' memory steadily until they were OOM-killed.Redpanda supports
join_group0-6,sync_group0-4 andproduce0-8, persrc/v/kafka/protocol/schemata/*_request.json, the same ondev.This is what Sarama sends for each configured
Version. Withconfig.ApiVersionsRequest = falsethese are hard ceilings:V2_8_0_0(current default)V2_6_2_0(#5513)V2_4_0_0NewJoinGroupRequest)consumerGroup.syncGroupRequest)produceSet.buildRequest)So with #5513 merged, Redpanda would still reject JoinGroup v7, and SyncGroup v5 right after it. At
V2_4_0_0every request is within Redpanda's ranges. We only observed the JoinGroup rejection; the consumers never get further. The rest of the table comes from the Sarama source.Two ways to cover both Kafka 2.6.x brokers and Redpanda:
sarama.ParseKafkaVersion, defaulting to whatever feat(kafka): speak Kafka 2.6.2 in the Watermill Sarama driver #5513 settles on. Redpanda users would set2.4.0.ApiVersionsRequest. Sarama then clamps each request to the broker's advertised range (restrictApiVersioninapi_versions.go, called from the broker's send path), which works for any broker without picking a version. chore: filter out sarama autonegotation issue #3546 turned it off to stop theApiVersionsRequesterrors flooding the logs, so that noise would need handling another way.Happy to test either against Redpanda.
ToniAdreal commentedon Nov 17, 2026
Verified @jedi-tal's table independently against the Sarama version pinned in this repo's go.mod (IBM/sarama v1.61.1) and Redpanda's schemata on dev. All three rows check out.
JoinGroup:
NewJoinGroupRequestin saramajoin_group_request.gosends v7 at 2.5.0 and above, v6 at 2.4.0. So 2.8.0 and 2.6.2 both send v7, 2.4.0 sends v6.SyncGroup:
consumer_group.gosyncGroupRequestsends v5 at 2.5.0 and above, v4 at 2.4.0. So 2.8.0 and 2.6.2 both send v5, 2.4.0 sends v4.Produce:
produce_set.gobuildRequestsends v9 at 2.8.0 and above, v8 at 2.4.0 and above. So 2.8.0 sends v9, 2.6.2 and 2.4.0 both send v8.Redpanda's ceilings from
src/v/kafka/protocol/schemata/*_request.json(validVersionson dev) are join_group 0-6, sync_group 0-4, produce 0-8, matching the report.So the conclusion holds. After #5513 pins the client to 2.6.2, JoinGroup still goes out as v7 and SyncGroup as v5, both above Redpanda's ceilings. At 2.4.0 all three land inside Redpanda's ranges (v6/v4/v8) and inside what a Kafka 2.6.2 broker accepts, since its maxima are v7/v5/v8.
On the two fix shapes: option 1 (configurable version, defaulting to #5513's 2.6.2) is the smaller change, and it keeps the #3546 decision to leave ApiVersionsRequest off. Option 2 would reopen the log flooding #3546 was closed to stop. I verified the numbers only, no live broker run, and I have no Redpanda deployment to test against. Happy to re-check either shape against the Sarama source if that helps.