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

Support Mongo's Stable API in MongoHealthIndicator #30849

Closed
HealthPDU opened this issue May 3, 2022 · 5 comments
Closed

Support Mongo's Stable API in MongoHealthIndicator #30849

HealthPDU opened this issue May 3, 2022 · 5 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@HealthPDU
Copy link

Hi,

We are using Mongo 5.0 and have implemented their stable-api. We now find the Mongo health-check no longer works and reports the following error -> error 323 (APIStrictError): 'Provided apiStrict:true, but the command buildInfo is not in API Version 1.

On closer inspection, the class uses the buildinfo command (https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/mongo/MongoHealthIndicator.java) and this is not supported in Mongo's versioned api -> https://www.mongodb.com/docs/manual/reference/stable-api/#api-v1-commands

Are there plans to use commands supported by the versioned api?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 3, 2022
@wilkinsona
Copy link
Member

wilkinsona commented May 3, 2022

Are you aware of a command in the stable API that can act as a replacement for buildinfo? Upon an initial look, I couldn't see one that would provide a reasonable health check or that provides the version that we currently return in the health details.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label May 3, 2022
@wilkinsona wilkinsona changed the title spring-boot-actuator - MongoDB versioned API Support Mongo's Stable API in MongoHealthIndicator May 3, 2022
@jyemin
Copy link

jyemin commented May 6, 2022

There is no command in the stable API that provides the server version. The closest would be the hello command (formerly isMaster), whose reply includes the maxWireVersion field. This field in incremented with every major release of the MongoDB server, but not patch releases. So it can be used as a rough substitute for the version field in buildInfo, but it is not an exact replacement.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 6, 2022
@philwebb philwebb added the for: team-attention An issue we'd like other members of the team to review label May 13, 2022
@philwebb
Copy link
Member

Assuming that hello is available in both the stable and regular API we'll switch to that in 3.0.x. We'll replace the version detail with maxWireVersion since those represent different things.

If someone wants to use the stable API with 2.x we suggest that they write their own HealthIndicator since it's not much code.

@philwebb philwebb added type: enhancement A general enhancement and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Aug 24, 2022
@philwebb philwebb added this to the 3.0.x milestone Aug 24, 2022
@jyemin
Copy link

jyemin commented Aug 24, 2022

The hello command is available in both stable and regular API, but it was only added to the server in the 4.2 release. So probably safer to stick with isMaster to support a wider range of server releases. The isMaster command is also part of the stable API, so it's safe to use.

@mbhave mbhave self-assigned this Sep 13, 2022
@mbhave mbhave closed this as completed in b44a7e2 Sep 15, 2022
@mbhave mbhave modified the milestones: 3.0.x, 3.0.0-M5 Sep 16, 2022
@mbhave
Copy link
Contributor

mbhave commented Sep 16, 2022

Keeping the issue open to remind me to update the release notes.

@mbhave mbhave reopened this Sep 16, 2022
@mbhave mbhave closed this as completed Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

6 participants