Skip to content

Commit

Permalink
Fix SynchronousMetricStorageTest flake (#5981)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg committed Nov 14, 2023
1 parent 8901416 commit 9ac678e
Showing 1 changed file with 5 additions and 6 deletions.
Expand Up @@ -413,16 +413,15 @@ void recordAndCollect_concurrentStressTest(
// If we terminate when latch.count() == 0, the last collect may have occurred before
// the last recorded measurement. To ensure we collect all measurements, we collect
// one extra time after latch.count() == 0.
while (latch.getCount() != 0 && extraCollects <= 1) {
while (latch.getCount() != 0 || extraCollects <= 1) {
Uninterruptibles.sleepUninterruptibly(Duration.ofMillis(1));
MetricData metricData =
storage.collect(Resource.empty(), InstrumentationScopeInfo.empty(), 0, 1);
if (metricData.isEmpty()) {
continue;
if (!metricData.isEmpty()) {
metricData.getDoubleSumData().getPoints().stream()
.findFirst()
.ifPresent(pointData -> collect.accept(pointData.getValue(), cumulativeSum));
}
metricData.getDoubleSumData().getPoints().stream()
.findFirst()
.ifPresent(pointData -> collect.accept(pointData.getValue(), cumulativeSum));
if (latch.getCount() == 0) {
extraCollects++;
}
Expand Down

0 comments on commit 9ac678e

Please sign in to comment.