Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Mongo 4 java driver #2338

Closed
onobc opened this issue Nov 4, 2020 · 8 comments · Fixed by #2493
Closed

Upgrade to Mongo 4 java driver #2338

onobc opened this issue Nov 4, 2020 · 8 comments · Fixed by #2493
Assignees
Labels
enhancement A general enhancement release notes Noteworthy change to call out in the release notes
Milestone

Comments

@onobc
Copy link
Contributor

onobc commented Nov 4, 2020

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.
@shakuzen shakuzen added the enhancement A general enhancement label Nov 17, 2020
@shakuzen shakuzen added this to the 1.7.0 milestone Nov 17, 2020
@gustavomonarin
Copy link
Contributor

This issue sounds interesting.

Let me know if i can help with it @bono007 .

I just have created my first contribution to the project in a small issue change exactly on this area #2355

@onobc
Copy link
Contributor Author

onobc commented Nov 25, 2020

Hi @gustavomonarin ,
I have not got a chance to look into this. I am sure a pull request would be welcomed. If I happen to start working on this I will ping here to make sure we aren't both doing the same thing. If you start working on it, please do the same thing.

Thanks

@jonatan-ivanov
Copy link
Member

This will force Mongo 4 on consumers of the instrumentation.

Is this a good idea? Does anyone know if there is an EOL date for mongo-java-driver 3.x?

@onobc
Copy link
Contributor Author

onobc commented Feb 5, 2021

Hi @jonatan-ivanov

I was not able to find any EOL info directly on the driver, but we can do some rough analysis by comparing the server EOL w/ the driver compatibility matrix.

3.12 (the last 3.x version) is tested against MongoDB 4.4 but does not support all of the features. So most likely they will support 3.12 until 4.4 is EOL which is not currently scheduled.

I wrote this ticket with the fact that Spring Boot 2.3.0 (and move to Spring Data Neumann) has already forced the hand here for a large population of users in mind.

@jonatan-ivanov
Copy link
Member

@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.

@onobc
Copy link
Contributor Author

onobc commented Feb 6, 2021

I just would like to figure out what this upgrade would mean for micrometer users

Yep, it's a valid concern. I know this is probably a long shot, but are there any metrics (i'm really not trying a pun here) around the number of Mongo consumers that are not Spring Boot consumers as well?

so an upgrade in Spring Data does not necessarily triggers an upgrade in Micrometer

Agreed. So far they have seemed to stay pretty well in lockstep on compatibility on shared libs though.

, I'm going to ask the Spring Data Team about the background of dropping 3.x.

I know that the timing was right as SD was jumping major version from 2->3 which would be a "valid" time to make that breaking change jump in Mongo 3->4. I would love it if you could share any of that background you find (if it is unprivileged info).

@jonatan-ivanov jonatan-ivanov linked a pull request Mar 10, 2021 that will close this issue
@jonatan-ivanov jonatan-ivanov self-assigned this Mar 10, 2021
@jonatan-ivanov
Copy link
Member

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

@onobc
Copy link
Contributor Author

onobc commented 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.

@jonatan-ivanov this is great news! The Mongo3 use was blocking me adding this as auto-config in Boot like I did for the command listener. I will review these changes here shortly.

@shakuzen shakuzen added the release notes Noteworthy change to call out in the release notes label May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A general enhancement release notes Noteworthy change to call out in the release notes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants