You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DefaultLongTaskTimer class throws an IllegalArgumentException when percentiles is empty #4482
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 be null).
Considering the actual implementation of DefaultLongTaskTimer, I believe that it was intended to handle empty arrays nicely, the same way when it is null.
Is this a "theoretical" issue or you actually bumped into this in prod?
If so, how? You should not use DefaultLongTaskTimer directly or set the property to empty.
(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 DefaultLongTaskTimer is never instantiated directly, but it's indirectly referenced by PrometheusMeterRegistry in the function newLongTaskTimer when it calls new CumulativeHistogramLongTaskTimer.
We realize that when there's no annotation at all, the class is loaded with null in percentiles. And it handles it well.
The reason that made me believe it was an issue it's because the code seems to check the size in the comparison percentilesRequestedArr.length > 0, but this check logically a dead code (it will never be false) because when the length is 0 the ArrayBlockingQueue constructor throws the IllegalArgumentException.
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.
Activity
jonatan-ivanov commentedon Dec 15, 2023
Is this a "theoretical" issue or you actually bumped into this in prod?
If so, how? You should not use
DefaultLongTaskTimerdirectly or set the property to empty.(I'm not saying we should not fix this I'm only curious if this has production consequences.)
marcelopbarros commentedon Dec 15, 2023
@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
DefaultLongTaskTimeris never instantiated directly, but it's indirectly referenced byPrometheusMeterRegistryin the functionnewLongTaskTimerwhen it callsnew CumulativeHistogramLongTaskTimer.We realize that when there's no annotation at all, the class is loaded with
nullin percentiles. And it handles it well.The reason that made me believe it was an issue it's because the code seems to check the size in the comparison
percentilesRequestedArr.length > 0, but this check logically a dead code (it will never be false) because when the length is 0 theArrayBlockingQueueconstructor throws theIllegalArgumentException.So, my suggestion is to treat empty percentiles the same way as when they are
null.github-actions commentedon Dec 23, 2023
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.
github-actions commentedon Jan 2, 2024
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.
marcelopbarros commentedon Jan 4, 2024
Hi! The issue was closed, but I submitted the feedback here. Is it still going to be evaluated?
shakuzen commentedon Jan 17, 2024
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.
Avoid IllegalArgumentException on DefaultLongTaskTimer when percentil…