-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add kafka client example config #305
Conversation
Signed-off-by: Mahmoud Saada <mahmoudsaada@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have sample output?
labels: | ||
client_id: "$3" | ||
help: "Kafka client JMX metric $1 $2" | ||
type: COUNTER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Counters should end in _total
The other question would be, is there a way to get this data at the Java level that isn't JMX? This may be better done as a collector. |
You raise a great point @brian-brazil . Any pointers on writing collectors of this nature? or pulling out mbeans out of kafka client? I found this https://github.com/prometheus/client_java#custom-collectors but I'm not sure how to extract metrics directly from Kafka. Perhaps this is relevant? I'll attempt using |
Yes, https://github.com/apache/kafka/blob/2.0.0/clients/src/main/java/org/apache/kafka/common/metrics/MetricsReporter.java is what to look at. By writing a custom collector you can use this with any direct instrumentation you also have inside your application. |
This doens't parse the metrics name properly. Example output w/ client v 1.1.1:
|
I'm looking into Prometheus for monitoring Kafka producers across the system to identify any misconfiguration at a higher level, and JMX is the most simplest way (from an ops POV) to gather producer metrics across an entire JVM. So I think an examplke of that would be ideal to have on hand. @agolomoodysaada If you're still looking into this, the consumers and producers take a configuration item "metric.reporters" that is a list of class names that implement MetricsReporter, that's how you extract the metrics from the producer/consumer, but note that it's per instance. |
Hi guys, Also you can find here examples how to access all metrics from Kafka-clients, scrape it via implements |
Looks like a better way has been found. |
The current example are mostly for kafka brokers. Monitoring kafka clients is instrumental. The hour spent putting this config together can save others a lot of time.