mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Force endTimestamp to be strictly greater than or equal to startTimestamp
This fixes an error that we've been seeing from Stackdriver. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=132358790
This commit is contained in:
parent
daca7d65c2
commit
0e8d9e3859
1 changed files with 7 additions and 0 deletions
|
@ -21,6 +21,7 @@ import static google.registry.monitoring.metrics.MetricsUtils.newConcurrentHashM
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.google.common.util.concurrent.AtomicLongMap;
|
||||
import com.google.common.util.concurrent.Striped;
|
||||
import google.registry.monitoring.metrics.MetricSchema.Kind;
|
||||
|
@ -131,6 +132,12 @@ public final class Counter extends AbstractMetric<Long>
|
|||
valueLocks.get(labelValues).unlock();
|
||||
}
|
||||
|
||||
// There is an opportunity for endTimestamp to be less than startTimestamp if
|
||||
// one of the modification methods is called on a value before the lock for that value is
|
||||
// acquired but after getTimestampedValues has been invoked. Just set endTimestamp equal to
|
||||
// startTimestamp if that happens.
|
||||
endTimestamp = Ordering.natural().max(startTimestamp, endTimestamp);
|
||||
|
||||
timestampedValues.add(
|
||||
MetricPoint.create(this, labelValues, startTimestamp, endTimestamp, entry.getValue()));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue