Skip to content

Commit

Permalink
style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
edma2 committed Nov 6, 2024
1 parent a25b2e2 commit 6ec011b
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.sdk.common.Clock;
import io.opentelemetry.sdk.metrics.data.ExemplarData;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.BiFunction;
import javax.annotation.Nullable;

/** Base for fixed-size reservoir sampling of Exemplars. */
abstract class FixedSizeExemplarReservoir<T extends ExemplarData> implements ExemplarReservoir<T> {

@Nullable
private ReservoirCell[] storage;

@Nullable private ReservoirCell[] storage;
private final ReservoirCellSelector reservoirCellSelector;
private final BiFunction<ReservoirCell, Attributes, T> mapAndResetCell;
private final int size;
Expand All @@ -42,7 +40,7 @@ abstract class FixedSizeExemplarReservoir<T extends ExemplarData> implements Exe

@Override
public void offerLongMeasurement(long value, Attributes attributes, Context context) {
if (this.storage == null) {
if (storage == null) {
storage = initStorage();
}
int bucket = reservoirCellSelector.reservoirCellIndexFor(storage, value, attributes, context);
Expand All @@ -54,7 +52,7 @@ public void offerLongMeasurement(long value, Attributes attributes, Context cont

@Override
public void offerDoubleMeasurement(double value, Attributes attributes, Context context) {
if (this.storage == null) {
if (storage == null) {
storage = initStorage();
}
int bucket = reservoirCellSelector.reservoirCellIndexFor(storage, value, attributes, context);
Expand All @@ -77,7 +75,7 @@ public List<T> collectAndReset(Attributes pointAttributes) {
if (!hasMeasurements) {
return Collections.emptyList();
}
if (this.storage == null) {
if (storage == null) {
storage = initStorage();

Check warning on line 79 in sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/exemplar/FixedSizeExemplarReservoir.java

View check run for this annotation

Codecov / codecov/patch

sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/exemplar/FixedSizeExemplarReservoir.java#L79

Added line #L79 was not covered by tests
}
// Note: we are collecting exemplars from buckets piecemeal, but we
Expand Down

0 comments on commit 6ec011b

Please sign in to comment.