Skip to content

Allow JMX endpoint ObjectNames to be customized by providing an EndpointObjectNameFactory bean #25317

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

Closed
manueljordan opened this issue Feb 16, 2021 · 15 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@manueljordan
Copy link

Hello SB developers.

Just being curious and how a friendly suggestion and request.

If is possible change the name of an endpoint available through HTTP through

management.endpoints.web.path-mapping.info=information
management.endpoints.web.path-mapping.health=salud

Why not make available the same approach for JMX?, something like:

management.endpoints.jmx.mbean.info=information
management.endpoints.jmx.mbean.health=salud

I know it is not critical, but because it is available through Web. Why not give the developer or oversight the option to have HTTP and JMX keeping the same names.

Thanks for your understanding

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

We allow the endpoints paths to be changed when using HTTP for a couple of reasons:

  1. To match the path to the requirements of a general monitoring solution
  2. When configuring the base path to / to avoid a clash with one of the application's own endpoints

When using JMX, I don't think either of these needs exists. The MBeans are specific to Spring Boot so any monitoring tool that's querying them will also have to be, in part, Spring Boot specific as well. There's also no possibility of a clash as the MBean's are published with the org.springframework.boot domain.

We generally expect applications to be monitored using either JMX or HTTP so hadn't considered a need for consistent naming between the two. Do you have a particular need for them to be able to match?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Feb 16, 2021
@manueljordan
Copy link
Author

manueljordan commented Feb 16, 2021

Hi @wilkinsona

No particular critical reason, but in some unusual scenario, if we have two oversight working in http and jmx in the same time and each one through a different branch/option, and by remote, they would need coordinate to access to the same endpoints based with the same names.

Of course it is not critical, but would be a valid scenario, not very usual, but would happen.

I know, it is a trivial request.

If you want, proceed to close this issue.

@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 Feb 16, 2021
@wilkinsona
Copy link
Member

Thanks, @manueljordan.

We have an EndpointObjectNameFactory strategy interface that's used to create the ObjectName for each endpoint MBean. We don't, however, allow you to provide your own implementation. I'm not sure that this is a sufficiently common requirement that we should provide configuration properties for it, but it would be a small change to allow an EndpointObjectNameFactory to be provided as a bean. Let's see what the rest of the team thinks.

@wilkinsona wilkinsona added for: team-attention An issue we'd like other members of the team to review and removed status: feedback-provided Feedback has been provided labels Feb 16, 2021
@manueljordan
Copy link
Author

Sounds great @wilkinsona !

Other reason is when a nice project manager in his infinite wisdom wants all the endpoints in Spanish - or perhaps - French, Portuguese

I think the point is have this approach available to bring flexibility ... I know is not critical, is trivial, but would be a possible requirement at some point of time.

@snicoll
Copy link
Member

snicoll commented Feb 17, 2021

Exposing a way to customize the EndpointObjectNameFactory sounds good to me. However, I am wondering how practical this would be without making DefaultEndpointObjectNameFactory public somehow.

@mbhave
Copy link
Contributor

mbhave commented Feb 17, 2021

Can we expose it via a property that DefaultEndpointObjectNameFactory would consume instead?

@snicoll
Copy link
Member

snicoll commented Feb 17, 2021

A property that defines what part exactly? The ObjectName is quite complex so I am not sure that I'd want that in properties.

@mbhave
Copy link
Contributor

mbhave commented Feb 17, 2021

oh I thought we wanted to make just the name part configurable. But maybe I've misunderstood the issue.

@snicoll
Copy link
Member

snicoll commented Feb 17, 2021

Thanks for confirming. That's what I was suspecting what you were referring to. IMO if we offer a way to customise this, we should aim at the objectname, not a part of it.

@philwebb
Copy link
Member

We're going to makeEndpointObjectNameFactory a bean that you can add yourself. We won't make DefaultEndpointObjectNameFactory public because we think generally it's not a good idea to rename the JMX beans (for example, IDE tooling often needs specific names).

@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 labels Feb 19, 2021
@philwebb philwebb added this to the 2.5.x milestone Feb 19, 2021
@manueljordan
Copy link
Author

we think generally it's not a good idea to rename the JMX beans (for example, IDE tooling often needs specific names)

It is about any domain created by the same Java Application, right?. If I am not correct, expand pls a little more the idea.

The goal with the original post is only edit or rename any MBean available only within the org.springframework.boot domain. Has no sense change the other domains available within the same App

@wilkinsona
Copy link
Member

IDE tooling uses the MBeans provided by the Actuator to display information about your app. If you rename them, that tooling will break.

@wilkinsona wilkinsona changed the title Let change the name of an endpoint for JMX too. Allow JMX endpoint ObjectNames to be customized by providing an EndpointObjectNameFactory bean Feb 19, 2021
@manueljordan
Copy link
Author

I understand now, thanks for the clarification, why not use a kind of alias? Keep the original name for the IDE (nothing is break) and apply the alias (through a special annotation) and a flag set to true to enable recognize that annotation, through a property defined in application.properties, to let JConsole/VisualVM use that alternative/alias value.

@snicoll snicoll self-assigned this Mar 1, 2021
@snicoll
Copy link
Member

snicoll commented Mar 2, 2021

@manueljordan we've already described what our plan is, see this comment above. As we don't think it's not a good idea to rename the JMX beans, we won't provide such first class support for it.

@manueljordan
Copy link
Author

Hello @snicoll - Yes, it only was a thought. That's all and understood

@snicoll snicoll modified the milestones: 2.5.x, 2.5.0-M3 Mar 5, 2021
@snicoll snicoll closed this as completed in bb0f43c Mar 5, 2021
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