Expose a second endpoint in the gateway actuator example and note path based routes - #4288
gohri81-tech wants to merge 4 commits into
Conversation
Adds health to the endpoint exposure example and a note explaining that the actuator endpoints are mapped by a handler mapping ordered ahead of the gateway's own, so a catch-all route does not shadow /actuator/**. See spring-cloudgh-1265 Signed-off-by: Gaurav K Ohri <gohri81@gmail.com>
Signed-off-by: Gaurav K Ohri <gohri81@gmail.com>
spencergibb
left a comment
There was a problem hiding this comment.
This doesn't make sense to me. Gateway actuator doesn't have anything to do with it's handler mapping. They are loaded in the same context as the regular actuator.
Leaves only the change the issue asked for, exposing a second endpoint in the example. The note explained the resolution through the gateway handler mapping order, which is not how the gateway actuator endpoint is reached, and it also named a property prefix that no longer exists. Signed-off-by: Gaurav K Ohri <gohri81@gmail.com>
|
You're right, and I've removed the note (24ebcd7). The PR is now just the one line the issue actually asked for, Two things were wrong with what I wrote. The smaller one: I quoted That leaves the other half of gh-1265 open, the "note or warning about root routes" the reporter asked for. I'd rather ask than guess again: is that worth documenting at all on this page, and if so would you want it phrased purely in Boot terms (actuator endpoints are mapped independently of the gateway routes, so a catch-all route does not affect them) with no mention of handler mappings or ordering? Happy to add that, or to leave the PR as the example change only and let the root-route part of the issue be closed separately. One bit of noise I can't avoid through the web editor: it rewrites the final |
|
I see. I note about path-based routes that would match instead of actuator would be helpful. I suppose I was confused about the wording. |
Describes when a route with a path predicate is matched instead of an actuator endpoint: a separate management.server.port, or a handler mapping order lowered below the actuator one. Phrased in Boot terms rather than as gateway specific behaviour. Signed-off-by: Gaurav K Ohri <gohri81@gmail.com>
|
Thanks - that's added in 5253ab2, and this time the note only talks about the case you named, a path based route matching instead of the actuator endpoint, with no claim that the gateway is involved in mapping the endpoint itself. What it says:
And one line on what to do about it: list the prefixes you actually want to route instead of using I deliberately left out the actuator handler mapping's numeric order so the page does not go stale on a Boot internal - "ordered ahead of" is the part that matters to a reader. The title and description are updated to cover both halves of gh-1265 again. Same caveat as before: I can't build the docs here, so please reword anything that isn't how you would put it, and the final |
|
A gentle nudge on this one when you have a moment. The note about path based routes was rewritten in 5253ab2 along the lines you suggested, so it now only describes the case you named and makes no claim that the gateway is involved in mapping the endpoint itself. The earlier review is still marked as requesting changes, so it would be good to know whether the new wording reads correctly to you. Both halves of gh-1265 are covered now: the example exposes |
Closes gh-1265
The issue asked for two things on the Actuator API page: another endpoint in the
management.endpoints.web.exposure.includeexample, and a note about root routes. Both are here now.The example exposes
gateway,healthinstead ofgatewayalone.The note describes when a route with a path predicate is matched instead of an actuator endpoint:
RoutePredicateHandlerMapping, whose order defaults to1(spring.cloud.gateway.server.webflux.handler-mapping.order), so a route withPath=/**does not prevent/actuator/gatewayfrom being served.management.server.port. The application port then stops serving them, while a route there whose predicate covers/actuator/**still matches and forwards those requests to itsuri.getHandlerInternalonly skips routing for requests arriving on the management port, so the endpoints stay reachable there.It closes with the two ways out: route the prefixes you actually want rather than
/**, or give the endpoints their own management port. The actuator handler mapping's numeric order is deliberately not quoted, so the page does not go stale on a Boot internal.My first attempt at this note explained the endpoint's reachability through the gateway's handler mapping, which @spencergibb rightly rejected:
/gatewayis an ordinary actuator endpoint registered in the same context, so that described the wrong thing, and the property name I quoted for the order no longer exists under that prefix. That note was dropped in 24ebcd7 and rewritten in 5253ab2 after his follow-up.Documentation only, no code change.
One artefact I can't avoid through the web editor: the final
|===line shows as changed because the file has no trailing newline. Happy to redo the change locally if you would rather not carry it.