Create a timer associated with an activity.
+ * + *If the provide ActivityDef contains a parameter "hdr_digits", then it will be used to set the number of + * significant digits on the histogram's precision.
+ * *This method ensures that if multiple threads attempt to create the same-named metric on a given activity, * that only one of them succeeds.
* @@ -98,15 +116,25 @@ public class ActivityMetrics { public static Timer timer(ActivityDef activityDef, String name) { String fullMetricName = activityDef.getAlias() + "." + name; Timer registeredTimer = (Timer) register(activityDef, name, () -> - new NicerTimer(fullMetricName, new DeltaHdrHistogramReservoir(fullMetricName, 4))); + new NicerTimer(fullMetricName, + new DeltaHdrHistogramReservoir( + fullMetricName, + activityDef.getParams().getOptionalInteger(HDRDIGITS_PARAM).orElse(_HDRDIGITS) + ) + )); return registeredTimer; } /** - *Create a histogram associated with an activity.
+ *Create an HDR histogram associated with an activity.
+ * + *If the provide ActivityDef contains a parameter "hdr_digits", then it will be used to set the number of + * significant digits on the histogram's precision.
+ * *This method ensures that if multiple threads attempt to create the same-named metric on a given activity, * that only one of them succeeds.
* + * * @param activityDef an associated activity def * @param name a simple, descriptive name for the histogram * @return the histogram, perhaps a different one if it has already been registered @@ -114,7 +142,13 @@ public class ActivityMetrics { public static Histogram histogram(ActivityDef activityDef, String name) { String fullMetricName = activityDef.getAlias() + "." + name; return (Histogram) register(activityDef, name, () -> - new NicerHistogram(fullMetricName, new DeltaHdrHistogramReservoir(fullMetricName, 4))); + new NicerHistogram( + fullMetricName, + new DeltaHdrHistogramReservoir( + fullMetricName, + activityDef.getParams().getOptionalInteger(HDRDIGITS_PARAM).orElse(_HDRDIGITS) + ) + )); } /** diff --git a/engine-cli/pom.xml b/engine-cli/pom.xml index 341d8710c..4ed1e7e85 100644 --- a/engine-cli/pom.xml +++ b/engine-cli/pom.xml @@ -4,7 +4,7 @@