Micrometer is a metrics library that provides some support for MongoDB. I’m migrating Micrometer to use the latest java driver (from 3.x to 4.x,
One of the metrics that Micrometer provides for MongoDB is the size of the wait queue (this information seems to be useful for the users). The instrumentation is implemented through the
MongoMetricsConnectionPoolListener. Since the
ConnectionPoolWaitQueueEnteredEvent and the
ConnectionPoolWaitQueueExitedEvent were removed in 4.x, we are not able to provide this metric that easily with 4.x.
ConcurrentPool has public methods to track this (
getAvailableCount) but its interface does not and getting a reference could also be tricky.
Is there a recommended way to track the wait queue size using the latest java driver (4.x)?