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
Recording metrics could cause errors in operational code #2187
Comments
@ChristianLMI Would you like to provide a PR? |
I'll try to find some time to at least get a first step done. However as I'm not too familiar with the project I might miss edges ;) |
@ChristianLMI It will be great if you can find time. If you decide to work on this please do the changes against The classes that need to have this enhancement are:
|
I created a PR. However now I need to figure out how to get an approval for the CLA. |
This PR is an improvement for #2237. When the AbstractHttpServerMetricsHandler.write method is getting an exception thrown by recordWrite, then the recordInactiveConnection is never called. So, this is too bad because the long adder for the active connection is then never decremented by the missed call to recordInactiveConnection, resulting in leaving the number of active connections to an inconsistent value. Fixes #2187
Motivation
I recently ran into an issue where an exception thrown in Micrometer caused my request to break. The actual issue I ran into is not in reactor although reactor was used. However as reactor uses Micrometer as well and e.g. [here|https://github.com/reactor/reactor-netty/blob/main/reactor-netty-core/src/main/java/reactor/netty/channel/AbstractChannelMetricsHandler.java] there also doesn't seem to be any protection of the main functionality against errors in metrics recording, this might be good to look at in reactor as well.
Desired solution
IMHO metrics should be of lower priority than production results. Therefor a failing metric registration should write a log entry but not abort the current operation.
Additional context
In my case a misconfigured a MeterFilter that caused NullPointerExceptions when recording a filtered metric.
The text was updated successfully, but these errors were encountered: