mirror of
https://github.com/google/nomulus
synced 2026-08-28 20:06:20 +00:00
Enforce monotonicity for IncrementableMetrics
This change enforces that IncrementableMetrics should only monotonically increase in value, and adds a new increment() method to increment by one, which is slightly faster than incrementBy (due to a lack of non-negative checking) in the common case that the counter should only be incremented by one. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130578421
This commit is contained in:
@@ -104,7 +104,7 @@ public class MetricReporter extends AbstractScheduledService {
|
||||
for (Metric<?> metric : metricRegistry.getRegisteredMetrics()) {
|
||||
points.addAll(metric.getTimestampedValues());
|
||||
logger.fine(String.format("Enqueued metric %s", metric));
|
||||
MetricMetrics.pushedPoints.incrementBy(1,
|
||||
MetricMetrics.pushedPoints.increment(
|
||||
metric.getMetricSchema().kind().name(), metric.getValueClass().toString());
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class MetricReporter extends AbstractScheduledService {
|
||||
logger.severe("writeQueue full, dropped a reporting interval of points");
|
||||
}
|
||||
|
||||
MetricMetrics.pushIntervals.incrementBy(1);
|
||||
MetricMetrics.pushIntervals.increment();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user