Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement missing overrides in NoopDistributionSummary #1159

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ enum NoopDistributionSummary implements DistributionSummary {
@Override public void record(long amount) {
}

@Override public void record(long[] amounts, int n) {
}

@Override public Iterable<Measurement> measure() {
return Collections.emptyList();
}
Expand All @@ -45,4 +48,22 @@ enum NoopDistributionSummary implements DistributionSummary {
@Override public long totalAmount() {
return 0L;
}

@Override
public BatchUpdater batchUpdater(int batchSize) {
return NoopBatchUpdater.INSTANCE;
}

private enum NoopBatchUpdater implements BatchUpdater {
INSTANCE;

@Override public void flush() {
}

@Override public void record(long amount) {
}

@Override public void close() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ public void testMeasure() {
NoopDistributionSummary t = NoopDistributionSummary.INSTANCE;
t.record(42);
Assertions.assertFalse(t.measure().iterator().hasNext());
t.record(new long[] { 1L, 2L, 3L }, 3);
Assertions.assertFalse(t.measure().iterator().hasNext());
}

@Test
public void testBatchUpdate() throws Exception {
NoopDistributionSummary t = NoopDistributionSummary.INSTANCE;
try (DistributionSummary.BatchUpdater batchUpdater = t.batchUpdater(10)) {
for (long i = 0; i < 100; i++) {
batchUpdater.record(i);
}
}
Assertions.assertFalse(t.measure().iterator().hasNext());
}
}
Loading