-
Notifications
You must be signed in to change notification settings - Fork 36
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
Metrics are improperly unregistered when application is undeployed #12
Comments
@pilhuhn Do you think that is something that can be fixed in smallrye-metrics or is it a spec concern too? |
As the MetricRegistries is @ApplicationScoped, when it is destroyed, it must clean up only the APPLICATION MetricRegistry. Do not flag the `getBaseRegistry` and `getVendorRegistry` as @ApplicationScope as they can be used outside of the application scope (e.g. it's the responsibility of the container runtime to clean up its vendor metrics). JIRA: smallrye#12
I think that the scope does not really matter here. If you removed the |
As the MetricRegistries is @ApplicationScoped, when it is destroyed, it must clean up only the APPLICATION MetricRegistry. JIRA: smallrye#12
closed by #13 |
The code in
smallrye-metrics/implementation/src/main/java/io/smallrye/metrics/MetricRegistries.java
Line 61 in de37ba4
Since MetricRegistries is
@ApplicationScoped
, when the application deployment is undeployed, itscleanUp
method is invoked and all 3 registries are cleared (without actually unregistering the metrics inside them btw).Imagine that an application server that support redeployment is running:
MetricsRegistries#cleanUp
method is invoked=> there are no longer any base and vendor metrics.
Proposed fix:
The `@ApplicationScoped' MetricRegistries should only clean up the application registry and leave the base and vendor ones untouched when it is destroyed.
In addition, I am not sure that the
getBaseRegistry()
andgetVendorRegistry()
should be@ApplicationScoped
. By definition, their scope is wider than the application as they provides metrics for the whole base (JVM) and vendor (app server) whose lifecycle is longer than application deployment.The text was updated successfully, but these errors were encountered: