in src/main/java/org/apache/sling/commons/scheduler/impl/QuartzJobExecutor.java [146:176]
private void measureJobEnd() {
if (jobStart == -1) {
// then measureJobStart was never invoked - hence not measuring anything
return;
}
if (overallRunningJobsCounter != null) {
overallRunningJobsCounter.dec();
}
if ( runningJobsCounter != null ) {
runningJobsCounter.dec();
}
final long elapsedMillis = System.currentTimeMillis() - jobStart;
// depending on slowness either measure via a separate 'slow' or the normal timer
// (and this triage can only be done by manual measuring)
if (slowThresholdMillis > 0 && elapsedMillis > slowThresholdMillis) {
// if the job was slow we (only) add it to a separate '.slow.' timer
// the idea being to not "pollute" the normal timer which would
// get quite skewed metrics otherwise with slow jobs around
if ( metricRegistry != null ) {
final String slowTimerName = QuartzScheduler.METRICS_NAME_TIMER + ".slow."
+ MetricsHelper.asMetricsSuffix(this.name);
metricRegistry.timer(slowTimerName).update(elapsedMillis, TimeUnit.MILLISECONDS);
}
} else {
// if the job was not slow, then measure it normally
if ( jobDurationTimer != null ) {
jobDurationTimer.update(elapsedMillis, TimeUnit.MILLISECONDS);
}
}
}