Skip to content

Commit

Permalink
Remove guage from the API.
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu committed Feb 6, 2020
1 parent bfc199a commit 0b7b29c
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 843 deletions.
117 changes: 0 additions & 117 deletions api/src/main/java/io/opentelemetry/metrics/DefaultMeter.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,6 @@ public static Meter getInstance() {
return INSTANCE;
}

@Override
public LongGauge.Builder longGaugeBuilder(String name) {
Utils.checkNotNull(name, "name");
Utils.checkArgument(
StringUtils.isPrintableString(name) && name.length() <= NAME_MAX_LENGTH,
ERROR_MESSAGE_INVALID_NAME);
return new NoopLongGauge.NoopBuilder();
}

@Override
public DoubleGauge.Builder doubleGaugeBuilder(String name) {
Utils.checkNotNull(name, "name");
Utils.checkArgument(
StringUtils.isPrintableString(name) && name.length() <= NAME_MAX_LENGTH,
ERROR_MESSAGE_INVALID_NAME);
return new NoopDoubleGauge.NoopBuilder();
}

@Override
public DoubleCounter.Builder doubleCounterBuilder(String name) {
Utils.checkNotNull(name, "name");
Expand Down Expand Up @@ -143,96 +125,6 @@ public LabelSet createLabelSet(Map<String, String> labels) {
return NoopLabelSet.INSTANCE;
}

/** No-op implementation of LongGauge interface. */
@Immutable
private static final class NoopLongGauge implements LongGauge {

/** Creates a new {@code NoopBound}. */
private NoopLongGauge() {}

@Override
public void set(long val, LabelSet labelSet) {}

@Override
public NoopBoundLongGauge bind(LabelSet labelSet) {
Utils.checkNotNull(labelSet, "labelSet");
return NoopBoundLongGauge.INSTANCE;
}

@Override
public void unbind(BoundLongGauge boundInstrument) {
Utils.checkNotNull(boundInstrument, "boundLongGauge");
}

/** No-op implementation of BoundLongGauge interface. */
@Immutable
private enum NoopBoundLongGauge implements BoundLongGauge {
INSTANCE;

@Override
public void set(long val) {}
}

private static final class NoopBuilder extends NoopAbstractGaugeBuilder<Builder, LongGauge>
implements Builder {

@Override
protected Builder getThis() {
return this;
}

@Override
public LongGauge build() {
return new NoopLongGauge();
}
}
}

/** No-op implementation of DoubleGauge interface. */
@Immutable
private static final class NoopDoubleGauge implements DoubleGauge {

/** Creates a new {@code NoopBound}. */
private NoopDoubleGauge() {}

@Override
public void set(double val, LabelSet labelSet) {}

@Override
public NoopBoundDoubleGauge bind(LabelSet labelSet) {
Utils.checkNotNull(labelSet, "labelSet");
return NoopBoundDoubleGauge.INSTANCE;
}

@Override
public void unbind(BoundDoubleGauge boundInstrument) {
Utils.checkNotNull(boundInstrument, "boundDoubleGauge");
}

/** No-op implementation of BoundDoubleGauge interface. */
@Immutable
private enum NoopBoundDoubleGauge implements BoundDoubleGauge {
INSTANCE;

@Override
public void set(double val) {}
}

private static final class NoopBuilder extends NoopAbstractGaugeBuilder<Builder, DoubleGauge>
implements Builder {

@Override
protected Builder getThis() {
return this;
}

@Override
public DoubleGauge build() {
return new NoopDoubleGauge();
}
}
}

/** No-op implementation of DoubleCounter interface. */
@Immutable
private static final class NoopDoubleCounter implements DoubleCounter {
Expand Down Expand Up @@ -500,15 +392,6 @@ public BatchRecorder put(DoubleMeasure measure, double value) {
public void record() {}
}

private abstract static class NoopAbstractGaugeBuilder<B extends Gauge.Builder<B, V>, V>
extends NoopAbstractInstrumentBuilder<B, V> implements Gauge.Builder<B, V> {

@Override
public B setMonotonic(boolean monotonic) {
return getThis();
}
}

private abstract static class NoopAbstractCounterBuilder<B extends Counter.Builder<B, V>, V>
extends NoopAbstractInstrumentBuilder<B, V> implements Counter.Builder<B, V> {

Expand Down
94 changes: 0 additions & 94 deletions api/src/main/java/io/opentelemetry/metrics/DoubleGauge.java

This file was deleted.

94 changes: 0 additions & 94 deletions api/src/main/java/io/opentelemetry/metrics/LongGauge.java

This file was deleted.

Loading

0 comments on commit 0b7b29c

Please sign in to comment.