Raymond created CAMEL-21422:
-------------------------------
Summary: CPU Load sometimes returns empty String
Key: CAMEL-21422
URL: https://issues.apache.org/jira/browse/CAMEL-21422
Project: Camel
Issue Type: Improvement
Reporter: Raymond
The ManagedRoute class
([https://www.javadoc.io/doc/org.apache.camel/camel-management/latest/org/apache/camel/management/mbean/ManagedRoute.html)]
has three methods to get the CPU Usage:
{{[getLoad01|https://www.javadoc.io/static/org.apache.camel/camel-management/4.8.1/org/apache/camel/management/mbean/ManagedRoute.html#getLoad01()]()}}
{{[getLoad0|https://www.javadoc.io/static/org.apache.camel/camel-management/4.8.1/org/apache/camel/management/mbean/ManagedRoute.html#getLoad01()]5()}}
{{[getLoad|https://www.javadoc.io/static/org.apache.camel/camel-management/4.8.1/org/apache/camel/management/mbean/ManagedRoute.html#getLoad01()]15()}}
{{I noticed things that could be improved:}}
{{1. Empty string}}
{{Sometimes the methods return an empty string. As I like to do calculations
and tried to convert it a BigDecimal I}} sometimes got:
{color:#1d1c1d}java.lang.NumberFormatException: null at
java.base/java.math.BigDecimal.<init>(BigDecimal.java:703)
Probably better to always at least return 0
2. Return type
The default return type is a String. As I understand this is a percentage, I
would expect a return type that match that, like a BigDecimal (or two decimal
Double)
3. Method name
The name of the method is getLoad01(). This seems unclear:
What does load mean (cpu, network, memory). And what does 01 mean?
Maybe
BigDecimal cpuLoad = managedRoute.getCPULoad(LoadInterval.1minute)
Where loadInterval is an enumeration with all possible (int) values.
4. Time interval
If possible,{color}
{color:#1d1c1d} that time interval could have more options between 1 minute to
1 hour.
{color}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)