mirror of
https://github.com/google/nomulus
synced 2026-07-26 18:12:38 +00:00
Add the Distribution data type for instrumentation
This is one of a series of CLs adding a new metric type, EventMetric, which is used for tracking numerical distributions. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=132103552
This commit is contained in:
@@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableList;
|
||||
/** Static helper methods for the Metrics library. */
|
||||
final class MetricsUtils {
|
||||
|
||||
private static final Double NEGATIVE_ZERO = -0.0;
|
||||
private static final String LABEL_SIZE_ERROR =
|
||||
"The count of labelValues must be equal to the underlying Metric's count of labels.";
|
||||
|
||||
@@ -45,4 +46,11 @@ final class MetricsUtils {
|
||||
static void checkLabelValuesLength(Metric<?> metric, ImmutableList<String> labelValues) {
|
||||
checkArgument(labelValues.size() == metric.getMetricSchema().labels().size(), LABEL_SIZE_ERROR);
|
||||
}
|
||||
|
||||
/** Check that the given double is not infinite, {@code NaN}, or {@code -0.0}. */
|
||||
static void checkDouble(double value) {
|
||||
checkArgument(
|
||||
!Double.isInfinite(value) && !Double.isNaN(value) && !NEGATIVE_ZERO.equals(value),
|
||||
"value must be finite, not NaN, and not -0.0");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user