Returns the last known Fact, chronologically, from a metric or KPI argument. If there are no Facts in the list or all of the Facts contain null or NaN values return a MissingFact which has no data and not breakdown. The MissingFact is a special case of a Fact object that can be useful to simplify defensive coding checks.
var timing = metrics.getLatest('Time to Resolve');
var inHours = timing.value(0.0) / 60.0;
if (inHours > 0){
console.log('Converting timing in minutes %s to hours', timing);
var breakdown = timing.breakdown();
if (breakdown){
console.log('Converting breakdown to hours %s', breakdown);
breakdown = breakdown.scale(1.0/60.0);
}
return {
'value' : inHours,
'breakdown' : breakdown
}
}