Skip to content

contrib: add Kafka stats sink for direct metric production via librdkafka#44137

Open
prashanthjos wants to merge 3 commits intoenvoyproxy:mainfrom
prashanthjos:kafka_stats_sink
Open

contrib: add Kafka stats sink for direct metric production via librdkafka#44137
prashanthjos wants to merge 3 commits intoenvoyproxy:mainfrom
prashanthjos:kafka_stats_sink

Conversation

@prashanthjos
Copy link
Copy Markdown
Contributor

@prashanthjos prashanthjos commented Mar 27, 2026

Commit Message:

add Kafka stats sink for direct metric production to Kafka topics

Additional Description:

This adds a new contrib stats sink (envoy.stat_sinks.kafka) that produces metrics directly to Apache Kafka topics via librdkafka. The motivation is to avoid the memory overhead of intermediate gRPC metrics collectors in large-scale deployments where the existing metrics_service sink creates significant memory pressure on collector infrastructure.
The sink supports two serialization formats:

  • JSON: human-readable metric objects, easy to consume with standard Kafka tooling.
  • Protobuf: binary-serialized StreamMetricsMessage containing MetricFamily entries, wire-compatible with the gRPC metrics_service sink, so existing consumers can deserialize without changes.

Other features include configurable batching, delta or absolute counter reporting, tag-as-label emission, and full librdkafka producer tuning (TLS, SASL/SCRAM, compression,etc.) via the producer_config map.

Risk Level: Low (new contrib extension, no changes to core Envoy code paths)
Testing: Unit tests for both JSON and Protobuf serialization covering counters, gauges, histograms, batching, delta/absolute values, label emission, empty snapshots, and config factory parsing. All tests pass locally.
Docs Changes: Added configuration docs, API reference toctree entry, and changelog entry.
Release Notes: Added to changelogs/current.yaml under new_features.
Platform Specific Features: N/A

…opics

Add a new contrib stats sink (envoy.stat_sinks.kafka) that produces metrics directly to Apache Kafka topics via librdkafka, avoiding the memory overhead of intermediate gRPC collectors at scale.

Features:
- JSON and Protobuf serialization (Protobuf uses StreamMetricsMessage, wire-compatible with the metrics_service gRPC sink)
- Configurable batching, delta/absolute counters, tag-as-label emission
- Full librdkafka producer tuning via producer_config map, including  TLS and SASL/SCRAM authentication support

Signed-off-by: Prashanth Josyula <prashanth.16@gmail.com>
…opics (#XXXXX)

Add a new contrib stats sink (envoy.stat_sinks.kafka) that produces metrics directly to Apache Kafka topics via librdkafka, avoiding the memory overhead of intermediate gRPC collectors at scale.

Features:
- JSON and Protobuf serialization (Protobuf uses StreamMetricsMessage,  wire-compatible with the metrics_service gRPC sink)
- Configurable batching, delta/absolute counters, tag-as-label emission
- Full librdkafka producer tuning via producer_config map, including TLS and SASL/SCRAM authentication support

Signed-off-by: Prashanth Josyula <prashanth.16@gmail.com>
…opics

Add a new contrib stats sink (envoy.stat_sinks.kafka) that produces metrics directly to Apache Kafka topics via librdkafka, avoiding the memory overhead of intermediate gRPC collectors at scale.

Features:
- JSON and Protobuf serialization (Protobuf uses StreamMetricsMessage, wire-compatible with the metrics_service gRPC sink)
- Configurable batching, delta/absolute counters, tag-as-label emission
- Full librdkafka producer tuning via producer_config map, including TLS and SASL/SCRAM authentication support

Signed-off-by: Prashanth Josyula <prashanth.16@gmail.com>
@prashanthjos prashanthjos changed the title Kafka stats sink contrib: add Kafka stats sink for direct metric production via librdkafka Mar 27, 2026
@prashanthjos
Copy link
Copy Markdown
Contributor Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant