python-diamond / Diamond

Diamond is a python daemon that collects system metrics and publishes them to Graphite (and others). It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.
http://diamond.readthedocs.org/
MIT License
1.74k stars 601 forks source link

Fixes the missing metrics from kafka.Controller:type=KafkaController #617

Closed prasincs closed 7 years ago

prasincs commented 7 years ago

All the metrics under kafka.Controller:type=KafkaController were missing because Kafka reports the stats as java.lang.Object.These are critical metrics like OfflinePartitionCount and ActiveControllerCount.

This patch also handles if the mbeans return empty or None for some reason. It will log for that particular objectName and move on. This will attempt to parse more objects than previous version but it's working okay for us. If it fails to find a numeric type, it will exit creating metrics. Since there was no fixture for this case I have added that too.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 24.127% when pulling 041899d966f95d1e7be36cfacf285c9013ac9f9e on prasincs:master into 943af9e7b8f2ee6a02af487ba5e2dc6101482579 on python-diamond:master.

prasincs commented 7 years ago

This has been fixed, I think it's somewhat of a bug fix rather than enhancement because some critical Kafka metrics were missing because the collector was ignoring them because of the type. I've added tests to fix these issues in future and to catch any regressions.