-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Add ability to define custom paths in actuator endpoints #10339
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
Comments
My gut feeling is that what you had in 1.5.x wasn't really an endpoint and was really a MVC controller in disguise. We've deliberately constrained the programming model in 2.0 so that it's no longer possible to create this sort of endpoint. This allows us to easily map operations to MVC, WebFlux, Jersey and JMX. In the case of your endpoints in 1.5, how were you dealing with the JMX side of things? |
We have an internal binding to JMX, so we were not using actuator for that. We were using the I see that the method name is used in the JMX binding to distinguish between operations, in fact, for a single But the method name is ignored in the web binding, so the following Endpoint:
... has a JMX binding in Spring-boot 2 but not a web binding, since both operations have the same path. So, there should be some way to declare multiple A possible solution may be to use the method name or an attribute of |
The endpoint you've shown is illegal as two operations will have the same request predicate. It should fail at runtime for that reason. What you've described (using Other than a few exceptions (such as controlling the HTTP response code) everything in the endpoint infrastructure has to be applicable to both web endpoints and JMX endpoints. I'm happy to continue discussing this and seeing if there's anything we can do to help, but anything we do will have to be within those constraints. |
It's still useful for the security side. See #10264. |
@spencergibb There's quite a lot of discussion above your comment so I'm not sure what "it" you are referring to. Can you explain in a little more detail please? |
Yeah, sorry. "It" being the |
@spencergibb I can't see any other mention of the condition in this issue. Did you mean to comment elsewhere? If not, can we please try to keep this issue focussed on the topic raised by @nicolaferraro which is already rather broad. |
Well, the problem I'm raising has little to do with rest or JMX mapping. I'd like to see if there's room for improvement for the current definition of actuator endpoints. Given the current implementation, if I want to create a "controlled object" with 4 operations named "start", "stop", "pause" and "resume", I have the following options:
The first solution is ok for me, I was just trying to suggest something better for this use case (i.e. allow to write multiple methods/operations on the same bean/endpoint without having to play with string switch). |
I wouldn't model that as four different operations. IMO, that's a single operation for writing the controlled object's state. In a web API you'd make a If what I've described above can't be modelled with the current endpoint infrastructure then I'd be interested in exploring if we can fix that. If you want to do something that's more web-specific and uses more of Spring MVC's features then you should write a Spring MVC controller. |
As I understand it the current model allows you to accept a single argument of type String or enum. So that might be fine for the lifecycle use case above. It doesn't help with anything more generic though. It would help us a lot if we could POST a |
You can POST multiple arguments. Anything without a
I'm not sure that a map is particularly JMX-friendly, not with JConsole anyway |
Let's say you want to add some k-v pairs to a |
Also see #10257 |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
The new actuator abstraction allows to define dynamic endpoints using the
@Selector
annotation, but it doesn't offer any help when you want to define e.g. multiple types of operation on the same resource.For example, we (Apache Camel) have some actuator endpoints in v. 1.5.x that define write operations on the following paths:
Where
{id}
is a route id on a specific actuator endpoint.If we want to replicate the same behavior on v2.x we need to define a method like:
Looking at the code that determines the path, this is the best I can do to replicate the same behavior that was present in 1.5.x.
Can this be improved before RC?
The text was updated successfully, but these errors were encountered: