lightblue-platform/lightblue-mongo

Expose mongo connection info via JMX

Opened this issue · 0 comments

Mongo driver already does that [1], but there are issues.

  1. Mongo driver creates one ConnectionPoolStatisticsMBean per replica set member per MongoClient instance. That gives 5 mongo nodes * 3 mongo clients (one for data, one for metadata and one for no reason) = 15 mbeans for each lightbluecrud node. All of them are visible in graphite under generic labels, making it not so easy to find useful data (data client connections to primary mongo node is probably what you want).
  2. Each MongoClient is identified by a unique hash, also used to differentiate between ConnectionPoolStatisticsMBean instances. The hash is re-generated after each server restart, so there is no graph continuity. Each time period between jboss restarts is logged under a different tree path in graphite.

To make it useful, let's register new mbeans, 2 per each replica set member:

  • com.redhat.lightblue.mbean:type=MongoConnectionPool,ds=data,host=primarymongodb
  • com.redhat.lightblue.mbean:type=MongoConnectionPool,ds=metadata,host=primarymongodb
  • com.redhat.lightblue.mbean:type=MongoConnectionPool,ds=data,host=secondarymongodb
  • com.redhat.lightblue.mbean:type=MongoConnectionPool,ds=metadata,host=secondarymongodb

(...)

Each would have following attributes (same as ConnectionPoolStatisticsMBean):
MaxSize=100
CheckedOutCount=0
WaitQueueSize=0
MinSize=0
Size=0
Host=mongodb
Port=27017

[1] http://mongodb.github.io/mongo-java-driver/3.0/driver/reference/management/monitoring/