Hi,
Following up on SLING-2987 I'm wondering about the best way to
represent the results of health checks.
Right now the health check Result just provides a boolean isOk()
method, along with a getStatus() that's similar to a log level (ok,
warn, error etc.).
I haven't been using the status so far, so for now it's just a
pass/fail (along with a mini-log that provides unstructured details).
Another model that might be more useful (or YAGNI...hence this
question) would be:
public interface ResultThatHasAValue {
// The output value of this health check
public object getValue();
// The acceptable range of our value
public String getRange();
// True if our value is in range
public boolean isInRange();
// + logs as now
}
The advantage of this value-based result is that it can also be used
to aggregate values that might be analyzed in a finer way by external
JMX tools (as the healthcheck results are now available via JMX).
The range can be a simple mini-language with ranges like "true",
"between 12 and 41", "> 16", "some.*Regexp", etc.
WDYT, does anyone have a concrete use case for ResultThatHasAValue?
Otherwise I'll stick with the current pass/fail (+logs) results.
Note that the docs at [1] are out of date now, but if you want to play
with the health check just build and install the two bundles found
under contrib/extensions/healthcheck and open
/system/console/healthcheck
-Bertrand
[1] http://sling.apache.org/documentation/bundles/sling-health-check-tool.html