-
Notifications
You must be signed in to change notification settings - Fork 41.9k
Description
Starting with MongoDB Driver 5.7.0 (currently 5.7.0-beta0), the driver provides a native Micrometer instrumentation through MongoClientSettings:
MicrometerObservabilitySettings observabilitySettings = MicrometerObservabilitySettings.builder()
.observationRegistry(…).build();
MongoClientSettings.builder().observabilitySettings(observabilitySettings);Using MongoDB's instrumentation should replace MongoMetricsCommandListener as command metrics are provided directly by the driver. Right now, 5.7.0-beta0 provides metrics only for synchronous MongoDB interaction, the reactive part will be provided within the 5.7.0 release.
It could make sense to initially flip the defaults for management.metrics.mongodb.command.enabled to matchIfMissing = false as escape hatch for projects that do not immediately want to migrate to the new observability integration. Such a migration path suggests introduction of a config property management.metrics.mongodb.observability.enabled to disable configuration of MicrometerObservabilitySettings.
Spring Data plans to upgrade to the 5.7 driver with the 2026.0.0-M2 Data milestone (Boot 4.1.0-M3), the MongoDB team is aware that a GA version of their driver is required by mid-April before entering the release candidate phase.