-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
MicroProfile Metrics, Health, OpenAPI URI changed #15030
Comments
Thanks @AdamBien - just to check the two end points I see in microprofile spec referenced is Now on the issue, the reason for moving to a
Thats the reasons and #1 prevents (at least in the current form) us from having That said - the health and metrics are in a grey area here. One is the microprofile spec the other is that many health check and metric systems most likely don't honor 30x's - most likely because of not having activated redirection (an oversight) or they actually deliberately did not do it for performance reasons. We do have an option available to remove If Quarkus from day one have had check points at I see a few options:
Considering the two reasons why we introduced And I want to say it is (to me) not about microprofile spec compliance having to be the default in Quarkus but that existing users deployments/setups in production will fail to expose metrics and health checkpoints because those systems does not honour 30x redirects. @kenfinnigan and @stuartwdouglas wdyt? |
I think I'd vote for option 3 (if we make sure the performance hit is not too large and that applications trying to serve something on those endpoints receive priority). |
I would also prefer 3. But maybe do it for all current non application endpoints, not just the 3 spec related onces ? |
That is not an option IMO, we do not want to constantly have to consider namespace collisions. We need a place to (fairly) reliably add endpoints. That is why we added /q/ to begin with. We can't have a clean add of new items if we default every endpoint to the root(/). |
The spec is really secondary in this issue. Its about effect on existing production rollouts. |
Yes, if there is no performance hit for production i'm +3 for option 3 too. @kenfinnigan raised the perf concern so I'll have to await his comment on what it really was about. |
We can do option 3, the issue is the behavior would need to live in each of those extensions instead of a central location, but the config to turn it off would need to be centralized in Vert.x HTTP extension. We'd need to clearly document in the extensions why it's done this way to prevent other non-application extensions from doing the same as Health, Metrics. Would we still provide a redirect from |
We use a builder for non-application endpoints.. can we make it an option? (additional endpoint or "also serve from root"). Something that would allow the general "non-application endpoint" handling to register the additional route, too. |
Thinking it through I see the following:
Does that align with what you were describing @ebullient? For the redirect flag, do we skip creating a redirect when @maxandersen thoughts? |
I think the redirect was a bad call. Wherever we had a redirect, we should just serve the thing (additional route that could match an existing handler). Would that mean existing configuration can stay as-is.. ?! I think we still have the "does this endpoint nest under /q or should it be served from root" question, which is floating around in the OAuth/JWT space right now. My original thought was that Vert.x HTTP could be stupider: if the "also serve from root" flag is present, it creates an additional route using the endpoint's configured API... but that does make it harder to manage health/metrics/openapi/oauth-jwt as a group.. |
For me to grok it best - can you link to where this logic is handled now ? sounds like it is in a central place - not per extension ? |
Right now Health, as an example, does https://github.com/quarkusio/quarkus/blob/master/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java#L231 to register a non-application endpoint. The processing of the routes is then handled here: https://github.com/quarkusio/quarkus/blob/master/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java#L135 |
Thanks for the pointers @kenfinnigan - that helped. So, as I grok it we introduced two settings:
Then So this setting might better been named I think that would make sense and simply just instantly deprecate/remove the redirect setting. What is left is wether we can find a way to manage the other paths under thoughts? |
This redirect is applied to all non-application endpoints, not just Given the experience, it probably makes sense to ditch the redirect and just serve the handler on the original endpoint as well, with a flag to disable. The issue is trying to do this for MP specific endpoints, or a list of specific endpoints. It would need the extension to set a value with |
Is that true ? like |
All non application endpoints are redirected. In the VertxHttpProcessor, in the if statement a line below the link above, it checks if the route is a framework one (carryover of old name it seems) and does the redirect. Any route that calls nonApplicationRoute() on the builder will have the redirect applied |
...okey so /q/dev is not considered a non application route but something else. #I'm trying to grok what decides which is a non app route and which is not since if everyone gets added in the / then what is the point of having g /q to avoid collisions? Is it then purely setup to have one sub tree to secure ? |
It looks like Anything that calls https://github.com/quarkusio/quarkus/blob/master/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/RouteBuildItem.java#L142 will be considered one. Maybe what's needed is to change the default of calling Extensions need to explicitly indicate they should also be served from the root, as opposed to it being the default it is now. We can also have another flag to disable "serveFromRoot" completely |
so this "non-application-route" is not consistently applied I guess? But lets say Like, I thought that the reason for And that isn't the case for everything "non-application-route" (i.e. I wonder if we would do this knowing what we know now we would in stead of an "all or nothing" approach would just have some "on/off" properties for each or some grouping (like "microprofile-specs") to toggle would make more sense? |
The original reasoning for serving anything from the root after the move to I thought about on/off for each, but that gets really messy fast as we continue to add more endpoints. We can have a flag to enable a grouping of endpoints, maybe MP ones, to be served from the root as well as |
I think the default for the MP endpoints should be / (root) (or whatever the specs define), which is what everyone expected up to now. Then if users want, they could move those all under q/* using the provided flag. I wouldn't add any redirects and/or dual-serves, because it complicates things. Whether we should re-brake the early movers, or not, while unfortunate, IMO it is better to admit and correct a mistake early, rather than prolonging it. Besides those affected are already aware of the problem. But we need to act fast and explain properly. |
I would go for owning up to the issue and just do direct serve from both /q/* and /* The whole intention was to get /q/ uniquely namespaced and add redirects for backwards compatiabilty - which turned out to not work. So doing direct serve seem to be the simplest - possibly only do it for the spec routes since we already only do it partially. (i.e. @dandreadis btw. are you talking only about the spec locations or the additional paths that exist? |
/metrics, /health/, /openapi by default (with the flag moving them to the /q/ namespace) |
The list of endpoints that were moved under
In terms of what we do with any endpoints that we want to be served under the root, I think they should also be served under So every non-application endpoint is present under |
In Quarkus 1.12.0 I could have |
Possibly this is already addressed by #15458. I will take a look. |
Quarkus introduced: /q/ prefix for all non-application endpoints (/health, /metrics,/openapi) which is a not a conventional behaviour. The other MicroProfile runtimes behave as expected.
"/health", "/metrics", (...) endpoints accessed by MP Rest Clients / JAX-RS are currently broken,
because 301 is not honoured per default.
Quarkus should at least ship with the setting:
quarkus.http.non-application-root-path=/
The non-application endpoints could be shifted to a different location on-demand.
Expected behavior
Metrics, Health, OpenAPI URIs are exposed as specified in: https://download.eclipse.org/microprofile/microprofile-metrics-3.0/microprofile-metrics-spec-3.0.html#rest-api / https://download.eclipse.org/microprofile/microprofile-health-3.0/microprofile-health-spec-3.0.html#_response_codes_and_status_mappings
Actual behavior
/q is prepended
See also: https://adambien.blog/roller/abien/entry/quarkus_health_metrics_openapi_moved
To Reproduce
curl -i localhost:8080/health
Expected: 200
Actual: 301
The text was updated successfully, but these errors were encountered: