feat: add MongoDB client metadata#614
Conversation
Pass MongoDriverInformation to MongoClients.create() so RESTHeart is identified in the MongoDB driver handshake for server-side telemetry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
This is particularly valuable in multi-application environments where multiple services connect to the same MongoDB cluster: Microservices architectures — Identify which service made which query ✅ Spring Data MongoDB — Already implements this Any application using the MongoDB Java driver can implement this pattern, creating a unified view of connections in MongoDB server logs. |
Pass MongoDriverInformation to MongoClients.create() so RESTHeart is identified in the MongoDB driver handshake for server-side telemetry.
|
This is included in release 9.3.0 |



The PR incorporates MongoDB's wrapping client library specification for the connection handshake to allow library details to be included in the metadata written to
mongosormongodlogs.For example, this change would allow server-side logs such as the following:
For anyone hosting clusters with connections coming from different applications this can help differentiate connections and facilitate log analysis.
This is effectively the same approach taken by Spring Data MongoDB (see SpringDataMongoDB.java, AbstractMongoClientConfiguration.java), and just added to Morphia.