Hello,
I am new to Prometheus so, apologies if this already discussed but I didn't find anything form digging up the list and the web
I would like to get some suggestion on what is the proposed way of sending metrics to Prometheus from a set of Kafka Consumers
A simplified view of what I am trying to track is the following
I have a set of Kafka Consumers i.e. C1, C2 and C3
C1, C2 and C3 consume messages from different topics and each consumer is triggered by some of the messages and performs a task.
What I want to track is the number of messages each consumer processed and the time it takes to process each message.
At the moment I am using the push gateway option (from the java client) using the consumer name as the job name e.g.
pushAdd(registry,"C1") from C1
pushAdd(registry,"C2") from C2
pushAdd(registry,"C3") from C3
now, because each consumer is stateless and I want to speed up processing, I create a set of replicas, i.e. 5 replicas of C1, 5 of C2 and another 5 of C3 which are managed by a k8s cluster
each replica pushes metrics with the same manner and uses the consumer name as the job, i.e. all C1 replicas execute pushAdd(registry,"C1"), all C2 replicas use "C2" etc
When I visualise the metrics in grafana for each consumer, the overall graphics seem a bit off when multiple replicas are running.
What I cannot understand is if this is a grafana tuning thing or we are pushing metrics to Prometheus in a wrong way.
It would be great if I could get some feedback on the way we send metrics to Prometheus.
e.g. Is pushgateway appropriate for this case or scraping should be preferred?
if pushgaeway is the prefered option, should each replica continue using the same job name or use a different one (i.e. C1-{podid}) and group them together in prometheus/Grafana
if scraping is the way to go, can the metrics be persistent? since we can scale up / down the replicas on demand
Thank you in advance!
Dimitris