python-diamond/Diamond

MongoDbCollector sends several same-name metrics at a time, the latest set overwrites all the data sent to Graphite

stayen opened this issue · 0 comments

OS: Ubuntu 16.04, Diamond: 4.0.515

I was studying the issue of MongoDbCollector providing zero metrics for MongoDb in Graphite. Finally, I saw via catching the traffic that the MongoDB collector sends data sets like those below:

servers.servername.mongo.network_per_sec.numRequests 24 1497791440
servers.servername.mongo.network_per_sec.bytesOut 57890 1497791440
servers.servername.mongo.network_per_sec.bytesIn 4156 1497791440
servers.servername.mongo.network_per_sec.numRequests 0 1497791440
servers.servername.mongo.network_per_sec.bytesOut 0 1497791440
servers.servername.mongo.network_per_sec.bytesIn 0 1497791440

The result: zero values are stored in Graphite.

Possible solutions could be:

  1. sum up the COUNTER type of metrics, use the last one for GAUGE, before sending to Graphite
  2. add an option to send data to Graphite aggregator (that would require additional setup on Graphite side)

Currently, the above collector became meaningless and I perhaps will try to use the first "hack" to send actual data at a cost of wasting more RAM on Diamond side.