-
Notifications
You must be signed in to change notification settings - Fork 306
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
Setting default-web-module disables /metrics - FISH-785 #4924
Comments
Yes, the The current code of |
Hi @jGauravGupta, in case @thehpi would like to create a PR with a fix, can you help him how to know whether the application is the default webmodule? |
I assume that all what's needed is to add a hook to the code that sets an app as the default web module and install the MetricsServlet, similarly to how it's installed during deployment in case the context root is empty. And also another hook to clean up if an app is unset as the default module. |
Hi @thehpi, Thank you you for providing us with a very detailed reproducer. You seem to be very familiar with our codebase, is this something you will be interested in creating a PR with a fix? |
Reproduced the issue and created the internal ticket FISH-785 to address it. |
@MeroRai I'm not at all familiar with the payara codebase but I am familiar with using it :) As OndroMih noted in an earlier comment MetricsServletContainerInitializer doesn't work in payara server if an app is made default module after deployment. What I find strange is that it IS called when the default module is cleared. I guess what we need is:
If you can help me a bit I will be able to create a PR |
I created a commit for ref which fixes the issue for metrics endpoint and requires restart on config change: jGauravGupta@f8e09ad |
I investigated why the setting default-web-module setting did not activate immediately but clearing it did. |
Description
When I set the default-web-module, e.g using asadmin:
Then when I request the root context / this will be forwarded to test-web application so these calls do the same
However the /metrics endpoint doesn't work anymore after this setting. This kind of makes sense because the root context is mapped to my webapp. But it doesn't feel ok that the /metrics endpoint (and probably more like /health) don't work anymore.
Expected Outcome
I would expect the /metrics endpoint to keep on working and return things like
Current Outcome
When the default web module is set then the /metrics call returns 404.
I did find the following in MetricsServletContainerInitializer
public class MetricsServletContainerInitializer implements ServletContainerInitializer {
This indicates that metrics is only enabled for the root context. But this is only called on deployment AND when clearing the default-web-module. When setting the default web module this is not called but the /metrics endpoint doesn't work afterwards. So it looks like this relates to the problem but is not the only one.
Steps to reproduce (Only for bug reports)
See: https://github.com/thehpi/metrics-with-default-web-module
Follow the README
Environment
The text was updated successfully, but these errors were encountered: