question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade to Mongo 4 java driver

See original GitHub issue

Currently the Mongo DB instrumentation references legacy classes in the Mongo 3 java driver. Spring Boot requires the Mongo 4 driver starting with 2.3.0.RELEASE.

There are 2 Mongo listeners that provide metrics:

They both reference com.mongo.MongoClient (only for a Javadoc @link tag) which still exists in the Mongo 4 java driver, but its in the mongodb-driver-legacy lib. The connection pool listener, however, actually references event classes that have been removed in Mongo 4 driver.

Suggested plan:

  • Upgrade the Mongo dependency to mongodb-driver-sync
  • Replace the @link tag w/ {@code } therefore removing the dependency on any MongoClient (its not used anyways)
  • Replace the usage of the deleted event classes in the connection pool listener w/ their Mongo 4 equivalent events

Concerns:

  • This will force Mongo 4 on consumers of the instrumentation. It would have to be in a minor version release. There may be a way to use an lowest common denominator of Mongo 3 and 4 for the connection pool listener events so as to be usable by both Mongo 3 and 4.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jonatan-ivanovcommented, Mar 10, 2021

@bono007 Fyi, this is in progress (see the draft PR), after this is done, I will take a look at the extra tags.

1reaction
jonatan-ivanovcommented, Feb 6, 2021

@bono007 Makes sense, thank you for the info. I really encourage upgrading dependencies, I just would like to figure out what this upgrade would mean for micrometer users (last time I used the mongo-driver in prod was 2013 I guess, so I need to keep up).

Micrometer is not really a Spring library, it is used outside of Spring too so an upgrade in Spring Data does not necessarily triggers an upgrade in Micrometer but you made a great point, I’m going to ask the Spring Data Team about the background of dropping 3.x.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrading from the 3.12 Java driver - GitHub Pages
The following table specifies the compatibility of the MongoDB Java driver for use with a specific version of MongoDB. Java Driver Version, MongoDB...
Read more >
Upgrade Driver Versions — Java Sync - MongoDB
When upgrading driver versions, address all the breaking changes between the current and upgrade versions. For example, if you are upgrading the driver...
Read more >
Mongo java driver upgrade from 3.12.1 to 4.2.3 throwing ...
Completely stuck at this point in driver and spring upgrade process, without using com.mongodb.MongoClient in entire project it is throwing ...
Read more >
Mongo java driver upgrade from 3.12.1 to 4.2.3 throws method ...
For the record, Spring Boot 2.5.8 is compatible with Spring Data MongoDB 3.2.x and pulls in the driver version 4.2.3.
Read more >
Release Notes / Update of mongo-java-driver
The mongo-java-driver 3.11.2 has been updated to mongodb-driver-legacy 4.1.0 and mongodb-driver-core 4.1.0. This change required breaking changes as several ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found