/** * Get the aggregate durations for this request. * * @return A map of phase to duration (ns) */ public static Map<String, Long> getDurations() { RequestLog log = RLOG.get(); return log.durations(); }
/** * Adds the durations in milliseconds of all the recorded timed phases to a map. * * @return the map containing all the recorded times per phase in milliseconds */ private Map<String, Float> aggregateDurations() { Map<String, Long> durations = durations(); OptionalLong max = durations.entrySet() .stream() .filter(e -> e.getKey().contains(DRUID_QUERY_TIMER)) .mapToLong(Map.Entry::getValue) .peek(v -> REGISTRY.timer(DRUID_QUERY_ALL_TIMER).update(v, TimeUnit.NANOSECONDS)) .max(); if (max.isPresent()) { REGISTRY.timer(DRUID_QUERY_MAX_TIMER).update(max.getAsLong(), TimeUnit.NANOSECONDS); durations.put(DRUID_QUERY_MAX_TIMER, max.getAsLong()); } return durations.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> (float) e.getValue() / MS_PER_NS)); }