kafka-go icon indicating copy to clipboard operation
kafka-go copied to clipboard

Observability : Kafka Consumer/Producer metrics and tracing.

Open surenw-serenade opened this issue 2 years ago • 3 comments

Describe the solution you would like

Is there a recommended approach to instrumenting the kafka-go library with OpenTelemetry?

Standard consumer and producer metrics with support for standard prometheus or otel export capability would be useful.

Supporting documentation

https://kafka.apache.org/20/generated/producer_metrics.html https://kafka.apache.org/20/generated/consumer_metrics.html

surenw-serenade avatar Feb 11 '24 05:02 surenw-serenade

It looks like client side metrics would ideally be implemented with the interceptor concept (which I don't think has been added to this library yet): https://cwiki.apache.org/confluence/display/KAFKA/KIP-42%3A+Add+Producer+and+Consumer+Interceptors

Sovietaced avatar Aug 05 '24 21:08 Sovietaced

My perspective using Prometheus: you can call Writer.Stats() to get a WriterStats object full of metrics and do something with that. The same is valid for Reader.

I'm using reflection to automatically initialize the collectors (only counters) and to gather (Add) the values to each collector. Values are updated when /metrics is called. The only downside for me is that to get metrics by topic you need readers and writers for each topic.

mfelipe avatar Oct 15 '24 15:10 mfelipe

+1 for this.

fastbean-au avatar Apr 05 '25 05:04 fastbean-au