Class MongoMetricsCommandListener
java.lang.Object
io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener
- All Implemented Interfaces:
com.mongodb.event.CommandListener
@NonNullApi
@NonNullFields
@Incubating(since="1.2.0")
public class MongoMetricsCommandListener
extends Object
implements com.mongodb.event.CommandListener
CommandListener
for collecting command metrics from MongoClient
.- Since:
- 1.2.0
-
Constructor Summary
ConstructorDescriptionMongoMetricsCommandListener
(MeterRegistry registry) Constructs a command listener that uses the default tags provider.MongoMetricsCommandListener
(MeterRegistry registry, MongoCommandTagsProvider tagsProvider) Constructs a command listener with a custom tags provider. -
Method Summary
Modifier and TypeMethodDescriptionvoid
commandFailed
(com.mongodb.event.CommandFailedEvent event) void
commandStarted
(com.mongodb.event.CommandStartedEvent commandStartedEvent) void
commandSucceeded
(com.mongodb.event.CommandSucceededEvent event)
-
Constructor Details
-
MongoMetricsCommandListener
Constructs a command listener that uses the default tags provider.- Parameters:
registry
- meter registry
-
MongoMetricsCommandListener
Constructs a command listener with a custom tags provider.- Parameters:
registry
- meter registrytagsProvider
- provides tags to be associated with metrics for the given Mongo command- Since:
- 1.7.0
-
-
Method Details
-
commandStarted
public void commandStarted(com.mongodb.event.CommandStartedEvent commandStartedEvent) - Specified by:
commandStarted
in interfacecom.mongodb.event.CommandListener
-
commandSucceeded
public void commandSucceeded(com.mongodb.event.CommandSucceededEvent event) - Specified by:
commandSucceeded
in interfacecom.mongodb.event.CommandListener
-
commandFailed
public void commandFailed(com.mongodb.event.CommandFailedEvent event) - Specified by:
commandFailed
in interfacecom.mongodb.event.CommandListener
-