-
Notifications
You must be signed in to change notification settings - Fork 1k
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
DefaultLongTaskTimer class throws an IllegalArgumentException when percentiles is empty #4482
Comments
Is this a "theoretical" issue or you actually bumped into this in prod? (I'm not saying we should not fix this I'm only curious if this has production consequences.) |
@jonatan-ivanov I bumbped into this in a Spring Web application, while using Spring Boot 3. The application uses a default configuration of percentiles for a few environments. Then we use something like:
But, there is one environment that souldn't be calculating percentiles (because of the size of the metrics becoming to big). In this environment we override the configuration with an empty config.
The class We realize that when there's no annotation at all, the class is loaded with The reason that made me believe it was an issue it's because the code seems to check the size in the comparison Queue<Double> percentilesRequested = new ArrayBlockingQueue<>(
distributionStatisticConfig.getPercentiles() == null ? 1
: distributionStatisticConfig.getPercentiles().length);
double[] percentilesRequestedArr = distributionStatisticConfig.getPercentiles();
if (percentilesRequestedArr != null && percentilesRequestedArr.length > 0) {
Arrays.stream(percentilesRequestedArr).sorted().boxed().forEach(percentilesRequested::add);
} So, my suggestion is to treat empty percentiles the same way as when they are |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open. |
Hi! The issue was closed, but I submitted the feedback here. Is it still going to be evaluated? |
Sorry about that. It seems our bot didn't do what we expected. I see you've opened a pull request (#4483) for us as well. Thank you. |
Describe the bug
The
DefaultLongTaskTimer
class throws anIllegalArgumentException
whendouble[] percentiles
is notnull
, but it is empty.Environment
To Reproduce
How to reproduce the bug:
Also, in a Spring Boot 3.1.6 environment, if you set the metrics distribution to an empty configuration, the error throws when accessing
/actuator/prometheus
. (Empty configuration is useful when you have a default configuration and, for a specific environment you want it to benull
).Expected behavior
Considering the actual implementation of
DefaultLongTaskTimer
, I believe that it was intended to handle empty arrays nicely, the same way when it isnull
.The text was updated successfully, but these errors were encountered: