Skip to content
On this page

Micrometer Registry

Micrometer MongoDb is based on MongoCamp MongoDb Driver so the configuration for connections without given DAO are loaded like MongoCamp Driver is loading default connection.

Configurations for Micrometer MongoDb registry is loaded from application.conf (or reference.conf) path dev.mongocamp.micrometer.mongodb. For save max duration the setting save is used.

Registry with config

scala
val collectionName = "test_registry_collection_with_wait"
val registry = MongoStepMeterRegistry(collectionName, "unit.test.mongo")

Registry with DAO

scala
val collectionName = "test_registry_collection_with_wait_from_dao"
val dao = MongoTestServer.provider.dao(collectionName)
val registry = MongoStepMeterRegistry(dao)

Registry with overridden config

Every apply-methode for MongoStepMeterRegistry has the possibility to override the settings from application.conf with an Map[String, String], for example if you have multiple registries in running application with different settings.

scala
val collectionName = "test_registry_collection_with_wait_from_dao_15"
val configurationMap = Map("step" -> "15s", "save" -> "2m")
val registry = MongoStepMeterRegistry(collectionName, configurationMap)

The reference.conf default values are:

json
dev.mongocamp.micrometer.mongodb {
    step = 5m
    save = 15s
}

Released under the Apache License 2.0.