From db31f4a796abb76c38d2e9170d710e1e375b1260 Mon Sep 17 00:00:00 2001 From: Armin Ruech Date: Wed, 29 Jan 2020 19:29:11 +0100 Subject: [PATCH 1/6] Rename StringUtils.isNullOrBlank to isNullOrEmpty (#806) --- .../main/java/io/opentelemetry/internal/StringUtils.java | 2 +- .../java/io/opentelemetry/internal/StringUtilsTest.java | 7 ++++--- .../opentelemetry/sdk/trace/RecordEventsReadableSpan.java | 2 +- .../java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/api/src/main/java/io/opentelemetry/internal/StringUtils.java b/api/src/main/java/io/opentelemetry/internal/StringUtils.java index 627ef8e9283..1d8141767dd 100644 --- a/api/src/main/java/io/opentelemetry/internal/StringUtils.java +++ b/api/src/main/java/io/opentelemetry/internal/StringUtils.java @@ -41,7 +41,7 @@ private static boolean isPrintableChar(char ch) { return ch >= ' ' && ch <= '~'; } - public static boolean isNullOrBlank(String value) { + public static boolean isNullOrEmpty(String value) { return value == null || value.length() == 0; } diff --git a/api/src/test/java/io/opentelemetry/internal/StringUtilsTest.java b/api/src/test/java/io/opentelemetry/internal/StringUtilsTest.java index 4702102a019..f7f9fddac52 100644 --- a/api/src/test/java/io/opentelemetry/internal/StringUtilsTest.java +++ b/api/src/test/java/io/opentelemetry/internal/StringUtilsTest.java @@ -34,8 +34,9 @@ public void isPrintableString() { @Test public void isNullOrEmpty() throws Exception { - assertThat(StringUtils.isNullOrBlank("")).isTrue(); - assertThat(StringUtils.isNullOrBlank(null)).isTrue(); - assertThat(StringUtils.isNullOrBlank("hello")).isFalse(); + assertThat(StringUtils.isNullOrEmpty("")).isTrue(); + assertThat(StringUtils.isNullOrEmpty(null)).isTrue(); + assertThat(StringUtils.isNullOrEmpty("hello")).isFalse(); + assertThat(StringUtils.isNullOrEmpty(" ")).isFalse(); } } diff --git a/sdk/src/main/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpan.java b/sdk/src/main/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpan.java index 7755ea56582..fc8aa1bf4a0 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpan.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpan.java @@ -318,7 +318,7 @@ public void setAttribute(String key, boolean value) { public void setAttribute(String key, AttributeValue value) { Preconditions.checkNotNull(key, "key"); Preconditions.checkNotNull(value, "value"); - if (value.getType() == Type.STRING && StringUtils.isNullOrBlank(value.getStringValue())) { + if (value.getType() == Type.STRING && StringUtils.isNullOrEmpty(value.getStringValue())) { return; } synchronized (lock) { diff --git a/sdk/src/main/java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java b/sdk/src/main/java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java index 1ebe85e3e3f..482dd8e8d50 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java @@ -169,7 +169,7 @@ public Span.Builder setAttribute(String key, boolean value) { public Span.Builder setAttribute(String key, AttributeValue value) { Utils.checkNotNull(key, "key"); Utils.checkNotNull(value, "value"); - if (value.getType() == Type.STRING && StringUtils.isNullOrBlank(value.getStringValue())) { + if (value.getType() == Type.STRING && StringUtils.isNullOrEmpty(value.getStringValue())) { return this; } attributes.putAttribute(key, value); From 8b4c1488e936f42783396ebb9c44092364f7a339 Mon Sep 17 00:00:00 2001 From: Uladzislau Kiva Date: Thu, 30 Jan 2020 00:38:23 +0300 Subject: [PATCH 2/6] Solves #767 HttpTraceContext should not throw exceptions for non-fatal cases (#782) * fix: HttpTraceContext::extract() fails on traceparent == null (#767) * fix: HttpTraceContext::extract() fails on traceparent == null (#767) * fix: HttpTraceContext::extract() fails on traceparent == null (#767) * docs: add an * refactor: use invalid span context from HttpTraceContext * style: apply google code style Co-authored-by: Uladzislau Kiva --- .../opentelemetry/trace/propagation/HttpTraceContext.java | 8 +++++++- .../trace/propagation/HttpTraceContextTest.java | 7 +++++++ .../opentelemetry/context/propagation/HttpTextFormat.java | 3 ++- .../io/opentelemetry/opentracingshim/Propagation.java | 6 +++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/io/opentelemetry/trace/propagation/HttpTraceContext.java b/api/src/main/java/io/opentelemetry/trace/propagation/HttpTraceContext.java index e76acad4cf3..947a7c62ffa 100644 --- a/api/src/main/java/io/opentelemetry/trace/propagation/HttpTraceContext.java +++ b/api/src/main/java/io/opentelemetry/trace/propagation/HttpTraceContext.java @@ -62,6 +62,12 @@ public class HttpTraceContext implements HttpTextFormat { private static final char TRACESTATE_ENTRY_DELIMITER = ','; private static final Pattern TRACESTATE_ENTRY_DELIMITER_SPLIT_PATTERN = Pattern.compile("[ \t]*" + TRACESTATE_ENTRY_DELIMITER + "[ \t]*"); + static final SpanContext INVALID_SPAN_CONTEXT = + SpanContext.create( + TraceId.getInvalid(), + SpanId.getInvalid(), + TraceFlags.getDefault(), + Tracestate.getDefault()); @Override public List fields() { @@ -110,7 +116,7 @@ public void inject(SpanContext spanContext, C carrier, Setter setter) { TraceFlags traceFlags; String traceparent = getter.get(carrier, TRACEPARENT); if (traceparent == null) { - throw new IllegalArgumentException("Traceparent not present"); + return INVALID_SPAN_CONTEXT; } try { // TODO(bdrutu): Do we need to verify that version is hex and that for the version diff --git a/api/src/test/java/io/opentelemetry/trace/propagation/HttpTraceContextTest.java b/api/src/test/java/io/opentelemetry/trace/propagation/HttpTraceContextTest.java index 5016535c5e1..9e6e1611505 100644 --- a/api/src/test/java/io/opentelemetry/trace/propagation/HttpTraceContextTest.java +++ b/api/src/test/java/io/opentelemetry/trace/propagation/HttpTraceContextTest.java @@ -304,4 +304,11 @@ public void headerNames() { assertThat(TRACEPARENT).isEqualTo("traceparent"); assertThat(TRACESTATE).isEqualTo("tracestate"); } + + @Test + public void extract_emptyCarrier() { + Map emptyHeaders = new HashMap<>(); + assertThat(httpTraceContext.extract(emptyHeaders, getter)) + .isEqualTo(HttpTraceContext.INVALID_SPAN_CONTEXT); + } } diff --git a/context_prop/src/main/java/io/opentelemetry/context/propagation/HttpTextFormat.java b/context_prop/src/main/java/io/opentelemetry/context/propagation/HttpTextFormat.java index ff861558b43..26f3ece22cd 100644 --- a/context_prop/src/main/java/io/opentelemetry/context/propagation/HttpTextFormat.java +++ b/context_prop/src/main/java/io/opentelemetry/context/propagation/HttpTextFormat.java @@ -95,7 +95,8 @@ interface Setter { * @param carrier holds propagation fields. For example, an outgoing message or http request. * @param getter invoked for each propagation key to get. * @param carrier of propagation fields, such as an http request. - * @return the extracted value, never {@code null}. + * @return the extracted value or an invalid span context if getter returned {@code null}, never + * {@code null}. * @since 0.1.0 */ V extract(C carrier, Getter getter); diff --git a/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java b/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java index 5bd974845ea..eeb7ea2d430 100644 --- a/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java +++ b/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java @@ -23,6 +23,7 @@ import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nullable; final class Propagation extends BaseShimObject { Propagation(TelemetryInfo telemetryInfo) { @@ -38,6 +39,7 @@ public void injectTextFormat(SpanContextShim contextShim, TextMapInject carrier) .inject(contextShim.getCorrelationContext(), carrier, TextMapSetter.INSTANCE); } + @Nullable public SpanContextShim extractTextFormat(TextMapExtract carrier) { Map carrierMap = new HashMap(); for (Map.Entry entry : carrier) { @@ -48,7 +50,9 @@ public SpanContextShim extractTextFormat(TextMapExtract carrier) { tracer().getHttpTextFormat().extract(carrierMap, TextMapGetter.INSTANCE); io.opentelemetry.correlationcontext.CorrelationContext distContext = contextManager().getHttpTextFormat().extract(carrierMap, TextMapGetter.INSTANCE); - + if (!context.isValid()) { + return null; + } return new SpanContextShim(telemetryInfo, context, distContext); } From 5485e182804685bd5f30c7f24195ebf1e188cb41 Mon Sep 17 00:00:00 2001 From: Armin Ruech Date: Thu, 30 Jan 2020 18:59:28 +0100 Subject: [PATCH 3/6] Remove incorrect `@throws NullPointerException` in AttributeValue (#808) --- api/src/main/java/io/opentelemetry/trace/AttributeValue.java | 1 - 1 file changed, 1 deletion(-) diff --git a/api/src/main/java/io/opentelemetry/trace/AttributeValue.java b/api/src/main/java/io/opentelemetry/trace/AttributeValue.java index 7e8167e7055..c3e509bfd27 100644 --- a/api/src/main/java/io/opentelemetry/trace/AttributeValue.java +++ b/api/src/main/java/io/opentelemetry/trace/AttributeValue.java @@ -47,7 +47,6 @@ public enum Type { * * @param stringValue The new value. * @return an {@code AttributeValue} with a string value. - * @throws NullPointerException if {@code stringValue} is {@code null}. * @since 0.1.0 */ public static AttributeValue stringAttributeValue(String stringValue) { From 2d9d8d1d5c52fdb9d6b38feb0b1dad36a75a4f23 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 30 Jan 2020 14:03:20 -0800 Subject: [PATCH 4/6] Add base aggregator and double/long sum aggregator (#746) * Add base aggregator and double/long sum aggregator Signed-off-by: Bogdan Drutu * Update to use templates and move to main package Signed-off-by: Bogdan Cristian Drutu * Move inner classes to top level Signed-off-by: Bogdan Cristian Drutu * Rename BaseAggregator to Aggregator. Signed-off-by: Bogdan Cristian Drutu * Update copyright Signed-off-by: Bogdan Cristian Drutu * ./gradlew goJF Signed-off-by: Bogdan Cristian Drutu * Fix comments Signed-off-by: Bogdan Cristian Drutu --- .../opentelemetry/sdk/metrics/Aggregator.java | 60 +++++++++++++++++++ .../sdk/metrics/DoubleSumAggregator.java | 38 ++++++++++++ .../sdk/metrics/LongSumAggregator.java | 38 ++++++++++++ .../sdk/metrics/LongSumAggregatorTest.java | 31 ++++++++++ 4 files changed, 167 insertions(+) create mode 100644 sdk/src/main/java/io/opentelemetry/sdk/metrics/Aggregator.java create mode 100644 sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleSumAggregator.java create mode 100644 sdk/src/main/java/io/opentelemetry/sdk/metrics/LongSumAggregator.java create mode 100644 sdk/src/test/java/io/opentelemetry/sdk/metrics/LongSumAggregatorTest.java diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/Aggregator.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/Aggregator.java new file mode 100644 index 00000000000..c63262d8ae5 --- /dev/null +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/Aggregator.java @@ -0,0 +1,60 @@ +/* + * Copyright 2020, OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.opentelemetry.sdk.metrics; + +import javax.annotation.concurrent.ThreadSafe; + +/** Aggregator represents the base class for all the available aggregations. */ +@ThreadSafe +interface Aggregator> { + + /** + * Merge aggregated values between the current instance and the given {@code aggregator}. + * + * @param aggregator value to merge with. + */ + void merge(T aggregator); + + /** + * LongAggregator represents the base class for all the available aggregations that work with long + * values. + */ + @ThreadSafe + interface LongAggregator> extends Aggregator { + + /** + * Updates the current aggregator with a newly recorded value. + * + * @param value the new {@code long} value to be added. + */ + void update(long value); + } + + /** + * DoubleAggregator represents the base class for all the available aggregations that work with + * double values. + */ + @ThreadSafe + interface DoubleAggregator> extends Aggregator { + /** + * Updates the current aggregator with a newly recorded value. + * + * @param value the new {@code double} value to be added. + */ + void update(double value); + } +} diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleSumAggregator.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleSumAggregator.java new file mode 100644 index 00000000000..f3d97bf0458 --- /dev/null +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleSumAggregator.java @@ -0,0 +1,38 @@ +/* + * Copyright 2020, OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.opentelemetry.sdk.metrics; + +import com.google.common.util.concurrent.AtomicDouble; + +final class DoubleSumAggregator implements Aggregator.DoubleAggregator { + // TODO: Change to use DoubleAdder when changed to java8. + private final AtomicDouble value; + + DoubleSumAggregator() { + this.value = new AtomicDouble(); + } + + @Override + public void merge(DoubleSumAggregator other) { + this.value.addAndGet(other.value.get()); + } + + @Override + public void update(double value) { + this.value.addAndGet(value); + } +} diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/LongSumAggregator.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/LongSumAggregator.java new file mode 100644 index 00000000000..804f92aded9 --- /dev/null +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/LongSumAggregator.java @@ -0,0 +1,38 @@ +/* + * Copyright 2020, OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.opentelemetry.sdk.metrics; + +import java.util.concurrent.atomic.AtomicLong; + +final class LongSumAggregator implements Aggregator.LongAggregator { + // TODO: Change to use LongAdder when changed to java8. + private final AtomicLong value; + + LongSumAggregator() { + this.value = new AtomicLong(); + } + + @Override + public void merge(LongSumAggregator other) { + this.value.addAndGet(other.value.get()); + } + + @Override + public void update(long value) { + this.value.addAndGet(value); + } +} diff --git a/sdk/src/test/java/io/opentelemetry/sdk/metrics/LongSumAggregatorTest.java b/sdk/src/test/java/io/opentelemetry/sdk/metrics/LongSumAggregatorTest.java new file mode 100644 index 00000000000..93b47248a23 --- /dev/null +++ b/sdk/src/test/java/io/opentelemetry/sdk/metrics/LongSumAggregatorTest.java @@ -0,0 +1,31 @@ +/* + * Copyright 2020, OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.opentelemetry.sdk.metrics; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Unit tests for {@link LongSumAggregator}. */ +@RunWith(JUnit4.class) +public class LongSumAggregatorTest { + @Test + public void longSumAggregation() { + LongSumAggregator longSumAggregator = new LongSumAggregator(); + longSumAggregator.update(12); + } +} From 4e466cdf080f4fb2f7bc743547e7e37da58c444d Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 30 Jan 2020 14:31:39 -0800 Subject: [PATCH 5/6] Rename instruments consistently with MeterSdk (#809) * Rename instruments consistently with MeterSdk Signed-off-by: Bogdan Cristian Drutu * Add tests in MeterSdk for measure instrument instances Signed-off-by: Bogdan Cristian Drutu --- ...ubleCounter.java => DoubleCounterSdk.java} | 19 +++++---- ...ubleMeasure.java => DoubleMeasureSdk.java} | 19 +++++---- ...dkLongCounter.java => LongCounterSdk.java} | 18 ++++----- ...dkLongMeasure.java => LongMeasureSdk.java} | 18 ++++----- .../opentelemetry/sdk/metrics/MeterSdk.java | 8 ++-- ...terTest.java => DoubleCounterSdkTest.java} | 12 +++--- ...ureTest.java => DoubleMeasureSdkTest.java} | 12 +++--- ...unterTest.java => LongCounterSdkTest.java} | 12 +++--- ...asureTest.java => LongMeasureSdkTest.java} | 12 +++--- .../sdk/metrics/MeterSdkTest.java | 40 ++++++++++++++++++- 10 files changed, 102 insertions(+), 68 deletions(-) rename sdk/src/main/java/io/opentelemetry/sdk/metrics/{SdkDoubleCounter.java => DoubleCounterSdk.java} (80%) rename sdk/src/main/java/io/opentelemetry/sdk/metrics/{SdkDoubleMeasure.java => DoubleMeasureSdk.java} (80%) rename sdk/src/main/java/io/opentelemetry/sdk/metrics/{SdkLongCounter.java => LongCounterSdk.java} (81%) rename sdk/src/main/java/io/opentelemetry/sdk/metrics/{SdkLongMeasure.java => LongMeasureSdk.java} (81%) rename sdk/src/test/java/io/opentelemetry/sdk/metrics/{SdkDoubleCounterTest.java => DoubleCounterSdkTest.java} (89%) rename sdk/src/test/java/io/opentelemetry/sdk/metrics/{SdkDoubleMeasureTest.java => DoubleMeasureSdkTest.java} (89%) rename sdk/src/test/java/io/opentelemetry/sdk/metrics/{SdkLongCounterTest.java => LongCounterSdkTest.java} (89%) rename sdk/src/test/java/io/opentelemetry/sdk/metrics/{SdkLongMeasureTest.java => LongMeasureSdkTest.java} (89%) diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleCounter.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleCounterSdk.java similarity index 80% rename from sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleCounter.java rename to sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleCounterSdk.java index 8d0d0cbf4e1..190af3112d5 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleCounter.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleCounterSdk.java @@ -22,11 +22,11 @@ import java.util.List; import java.util.Map; -class SdkDoubleCounter extends BaseInstrument implements DoubleCounter { +final class DoubleCounterSdk extends BaseInstrument implements DoubleCounter { private final boolean monotonic; - private SdkDoubleCounter( + private DoubleCounterSdk( String name, String description, Map constantLabels, @@ -43,7 +43,7 @@ public void add(double delta, LabelSet labelSet) { @Override BoundDoubleCounter createBoundInstrument(LabelSet labelSet) { - return new SdkBoundDoubleCounter(labelSet, monotonic); + return new Bound(labelSet, monotonic); } @Override @@ -51,14 +51,14 @@ public boolean equals(Object o) { if (this == o) { return true; } - if (!(o instanceof SdkDoubleCounter)) { + if (!(o instanceof DoubleCounterSdk)) { return false; } if (!super.equals(o)) { return false; } - SdkDoubleCounter that = (SdkDoubleCounter) o; + DoubleCounterSdk that = (DoubleCounterSdk) o; return monotonic == that.monotonic; } @@ -70,12 +70,11 @@ public int hashCode() { return result; } - private static class SdkBoundDoubleCounter extends BaseBoundInstrument - implements BoundDoubleCounter { + private static final class Bound extends BaseBoundInstrument implements BoundDoubleCounter { private final boolean monotonic; - SdkBoundDoubleCounter(LabelSet labels, boolean monotonic) { + Bound(LabelSet labels, boolean monotonic) { super(labels); this.monotonic = monotonic; } @@ -89,7 +88,7 @@ public void add(double delta) { } } - static class Builder extends AbstractCounterBuilder + static final class Builder extends AbstractCounterBuilder implements DoubleCounter.Builder { private Builder(String name) { @@ -107,7 +106,7 @@ Builder getThis() { @Override public DoubleCounter build() { - return new SdkDoubleCounter( + return new DoubleCounterSdk( getName(), getDescription(), getConstantLabels(), getLabelKeys(), isMonotonic()); } } diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleMeasure.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleMeasureSdk.java similarity index 80% rename from sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleMeasure.java rename to sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleMeasureSdk.java index e738a891c5d..d252bee1171 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleMeasure.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/DoubleMeasureSdk.java @@ -22,11 +22,11 @@ import java.util.List; import java.util.Map; -class SdkDoubleMeasure extends BaseInstrument implements DoubleMeasure { +final class DoubleMeasureSdk extends BaseInstrument implements DoubleMeasure { private final boolean absolute; - private SdkDoubleMeasure( + private DoubleMeasureSdk( String name, String description, Map constantLabels, @@ -43,7 +43,7 @@ public void record(double value, LabelSet labelSet) { @Override BoundDoubleMeasure createBoundInstrument(LabelSet labelSet) { - return new SdkBoundDoubleMeasure(labelSet, this.absolute); + return new Bound(labelSet, this.absolute); } @Override @@ -51,14 +51,14 @@ public boolean equals(Object o) { if (this == o) { return true; } - if (!(o instanceof SdkDoubleMeasure)) { + if (!(o instanceof DoubleMeasureSdk)) { return false; } if (!super.equals(o)) { return false; } - SdkDoubleMeasure that = (SdkDoubleMeasure) o; + DoubleMeasureSdk that = (DoubleMeasureSdk) o; return absolute == that.absolute; } @@ -70,12 +70,11 @@ public int hashCode() { return result; } - private static class SdkBoundDoubleMeasure extends BaseBoundInstrument - implements BoundDoubleMeasure { + private static final class Bound extends BaseBoundInstrument implements BoundDoubleMeasure { private final boolean absolute; - SdkBoundDoubleMeasure(LabelSet labels, boolean absolute) { + Bound(LabelSet labels, boolean absolute) { super(labels); this.absolute = absolute; } @@ -89,7 +88,7 @@ public void record(double value) { } } - static class Builder extends AbstractMeasureBuilder + static final class Builder extends AbstractMeasureBuilder implements DoubleMeasure.Builder { private Builder(String name) { @@ -107,7 +106,7 @@ Builder getThis() { @Override public DoubleMeasure build() { - return new SdkDoubleMeasure( + return new DoubleMeasureSdk( getName(), getDescription(), getConstantLabels(), getLabelKeys(), isAbsolute()); } } diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkLongCounter.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/LongCounterSdk.java similarity index 81% rename from sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkLongCounter.java rename to sdk/src/main/java/io/opentelemetry/sdk/metrics/LongCounterSdk.java index 8f8bc060890..6f39e08d452 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkLongCounter.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/LongCounterSdk.java @@ -22,11 +22,11 @@ import java.util.List; import java.util.Map; -class SdkLongCounter extends BaseInstrument implements LongCounter { +final class LongCounterSdk extends BaseInstrument implements LongCounter { private final boolean monotonic; - private SdkLongCounter( + private LongCounterSdk( String name, String description, Map constantLabels, @@ -43,7 +43,7 @@ public void add(long delta, LabelSet labelSet) { @Override BoundLongCounter createBoundInstrument(LabelSet labelSet) { - return new SdkBoundLongCounter(labelSet, monotonic); + return new Bound(labelSet, monotonic); } @Override @@ -51,14 +51,14 @@ public boolean equals(Object o) { if (this == o) { return true; } - if (!(o instanceof SdkLongCounter)) { + if (!(o instanceof LongCounterSdk)) { return false; } if (!super.equals(o)) { return false; } - SdkLongCounter that = (SdkLongCounter) o; + LongCounterSdk that = (LongCounterSdk) o; return monotonic == that.monotonic; } @@ -70,11 +70,11 @@ public int hashCode() { return result; } - private static class SdkBoundLongCounter extends BaseBoundInstrument implements BoundLongCounter { + private static final class Bound extends BaseBoundInstrument implements BoundLongCounter { private final boolean monotonic; - SdkBoundLongCounter(LabelSet labels, boolean monotonic) { + Bound(LabelSet labels, boolean monotonic) { super(labels); this.monotonic = monotonic; } @@ -88,7 +88,7 @@ public void add(long delta) { } } - static class Builder extends AbstractCounterBuilder + static final class Builder extends AbstractCounterBuilder implements LongCounter.Builder { private Builder(String name) { @@ -106,7 +106,7 @@ Builder getThis() { @Override public LongCounter build() { - return new SdkLongCounter( + return new LongCounterSdk( getName(), getDescription(), getConstantLabels(), getLabelKeys(), isMonotonic()); } } diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkLongMeasure.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/LongMeasureSdk.java similarity index 81% rename from sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkLongMeasure.java rename to sdk/src/main/java/io/opentelemetry/sdk/metrics/LongMeasureSdk.java index 40f76b07388..abb7d3bb447 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkLongMeasure.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/LongMeasureSdk.java @@ -22,11 +22,11 @@ import java.util.List; import java.util.Map; -class SdkLongMeasure extends BaseInstrument implements LongMeasure { +final class LongMeasureSdk extends BaseInstrument implements LongMeasure { private final boolean absolute; - private SdkLongMeasure( + private LongMeasureSdk( String name, String description, Map constantLabels, @@ -43,7 +43,7 @@ public void record(long value, LabelSet labelSet) { @Override BoundLongMeasure createBoundInstrument(LabelSet labelSet) { - return new SdkBoundLongMeasure(labelSet, this.absolute); + return new Bound(labelSet, this.absolute); } @Override @@ -51,14 +51,14 @@ public boolean equals(Object o) { if (this == o) { return true; } - if (!(o instanceof SdkLongMeasure)) { + if (!(o instanceof LongMeasureSdk)) { return false; } if (!super.equals(o)) { return false; } - SdkLongMeasure that = (SdkLongMeasure) o; + LongMeasureSdk that = (LongMeasureSdk) o; return absolute == that.absolute; } @@ -70,11 +70,11 @@ public int hashCode() { return result; } - private static class SdkBoundLongMeasure extends BaseBoundInstrument implements BoundLongMeasure { + private static final class Bound extends BaseBoundInstrument implements BoundLongMeasure { private final boolean absolute; - SdkBoundLongMeasure(LabelSet labels, boolean absolute) { + Bound(LabelSet labels, boolean absolute) { super(labels); this.absolute = absolute; } @@ -88,7 +88,7 @@ public void record(long value) { } } - static class Builder extends AbstractMeasureBuilder + static final class Builder extends AbstractMeasureBuilder implements LongMeasure.Builder { private Builder(String name) { @@ -106,7 +106,7 @@ Builder getThis() { @Override public LongMeasure build() { - return new SdkLongMeasure( + return new LongMeasureSdk( getName(), getDescription(), getConstantLabels(), getLabelKeys(), isAbsolute()); } } diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/MeterSdk.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/MeterSdk.java index 4b42f832f20..9bf7b708357 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/metrics/MeterSdk.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/MeterSdk.java @@ -60,22 +60,22 @@ public DoubleGauge.Builder doubleGaugeBuilder(String name) { @Override public DoubleCounter.Builder doubleCounterBuilder(String name) { - return SdkDoubleCounter.Builder.builder(name); + return DoubleCounterSdk.Builder.builder(name); } @Override public LongCounter.Builder longCounterBuilder(String name) { - return SdkLongCounter.Builder.builder(name); + return LongCounterSdk.Builder.builder(name); } @Override public DoubleMeasure.Builder doubleMeasureBuilder(String name) { - return SdkDoubleMeasure.Builder.builder(name); + return DoubleMeasureSdk.Builder.builder(name); } @Override public LongMeasure.Builder longMeasureBuilder(String name) { - return SdkLongMeasure.Builder.builder(name); + return LongMeasureSdk.Builder.builder(name); } @Override diff --git a/sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkDoubleCounterTest.java b/sdk/src/test/java/io/opentelemetry/sdk/metrics/DoubleCounterSdkTest.java similarity index 89% rename from sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkDoubleCounterTest.java rename to sdk/src/test/java/io/opentelemetry/sdk/metrics/DoubleCounterSdkTest.java index 8f61f655212..d74195f7c1b 100644 --- a/sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkDoubleCounterTest.java +++ b/sdk/src/test/java/io/opentelemetry/sdk/metrics/DoubleCounterSdkTest.java @@ -29,20 +29,20 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Unit tests for {@link SdkDoubleCounter}. */ +/** Unit tests for {@link DoubleCounterSdk}. */ @RunWith(JUnit4.class) -public class SdkDoubleCounterTest { +public class DoubleCounterSdkTest { @Rule public ExpectedException thrown = ExpectedException.none(); private final MeterSdk testSdk = - new SdkMetricsProvider().create().get("io.opentelemetry.sdk.metrics.SdkDoubleCounterTest"); + new SdkMetricsProvider().create().get("io.opentelemetry.sdk.metrics.DoubleCounterSdkTest"); @Test public void testDoubleCounter() { LabelSet labelSet = testSdk.createLabelSet("K", "v"); DoubleCounter doubleCounter = - SdkDoubleCounter.Builder.builder("testCounter") + DoubleCounterSdk.Builder.builder("testCounter") .setConstantLabels(ImmutableMap.of("sk1", "sv1")) .setLabelKeys(Collections.singletonList("sk1")) .setDescription("My very own counter") @@ -64,7 +64,7 @@ public void testDoubleCounter() { @Test public void testDoubleCounter_monotonicity() { DoubleCounter doubleCounter = - SdkDoubleCounter.Builder.builder("testCounter").setMonotonic(true).build(); + DoubleCounterSdk.Builder.builder("testCounter").setMonotonic(true).build(); thrown.expect(IllegalArgumentException.class); doubleCounter.add(-45.77d, testSdk.createLabelSet()); @@ -73,7 +73,7 @@ public void testDoubleCounter_monotonicity() { @Test public void testBoundDoubleCounter_monotonicity() { DoubleCounter doubleCounter = - SdkDoubleCounter.Builder.builder("testCounter").setMonotonic(true).build(); + DoubleCounterSdk.Builder.builder("testCounter").setMonotonic(true).build(); thrown.expect(IllegalArgumentException.class); doubleCounter.bind(testSdk.createLabelSet()).add(-9.3); diff --git a/sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkDoubleMeasureTest.java b/sdk/src/test/java/io/opentelemetry/sdk/metrics/DoubleMeasureSdkTest.java similarity index 89% rename from sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkDoubleMeasureTest.java rename to sdk/src/test/java/io/opentelemetry/sdk/metrics/DoubleMeasureSdkTest.java index 682ccec364e..8be341b9773 100644 --- a/sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkDoubleMeasureTest.java +++ b/sdk/src/test/java/io/opentelemetry/sdk/metrics/DoubleMeasureSdkTest.java @@ -29,20 +29,20 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Unit tests for {@link SdkDoubleMeasure}. */ +/** Unit tests for {@link DoubleMeasureSdk}. */ @RunWith(JUnit4.class) -public class SdkDoubleMeasureTest { +public class DoubleMeasureSdkTest { @Rule public ExpectedException thrown = ExpectedException.none(); private final MeterSdk testSdk = - new SdkMetricsProvider().create().get("io.opentelemetry.sdk.metrics.SdkDoubleMeasureTest"); + new SdkMetricsProvider().create().get("io.opentelemetry.sdk.metrics.DoubleMeasureSdkTest"); @Test public void testDoubleMeasure() { LabelSet labelSet = testSdk.createLabelSet("K", "v"); DoubleMeasure doubleMeasure = - SdkDoubleMeasure.Builder.builder("testMeasure") + DoubleMeasureSdk.Builder.builder("testMeasure") .setConstantLabels(ImmutableMap.of("sk1", "sv1")) .setLabelKeys(Collections.singletonList("sk1")) .setDescription("My very own double measure") @@ -64,7 +64,7 @@ public void testDoubleMeasure() { @Test public void testDoubleMeasure_absolute() { DoubleMeasure doubleMeasure = - SdkDoubleMeasure.Builder.builder("testMeasure").setAbsolute(true).build(); + DoubleMeasureSdk.Builder.builder("testMeasure").setAbsolute(true).build(); thrown.expect(IllegalArgumentException.class); doubleMeasure.record(-45.77d, testSdk.createLabelSet()); @@ -73,7 +73,7 @@ public void testDoubleMeasure_absolute() { @Test public void testBoundDoubleMeasure_absolute() { DoubleMeasure doubleMeasure = - SdkDoubleMeasure.Builder.builder("testMeasure").setAbsolute(true).build(); + DoubleMeasureSdk.Builder.builder("testMeasure").setAbsolute(true).build(); thrown.expect(IllegalArgumentException.class); doubleMeasure.bind(testSdk.createLabelSet()).record(-9.3f); diff --git a/sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkLongCounterTest.java b/sdk/src/test/java/io/opentelemetry/sdk/metrics/LongCounterSdkTest.java similarity index 89% rename from sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkLongCounterTest.java rename to sdk/src/test/java/io/opentelemetry/sdk/metrics/LongCounterSdkTest.java index c2da71d2c29..2418a06381b 100644 --- a/sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkLongCounterTest.java +++ b/sdk/src/test/java/io/opentelemetry/sdk/metrics/LongCounterSdkTest.java @@ -29,20 +29,20 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Unit tests for {@link SdkLongCounter}. */ +/** Unit tests for {@link LongCounterSdk}. */ @RunWith(JUnit4.class) -public class SdkLongCounterTest { +public class LongCounterSdkTest { @Rule public ExpectedException thrown = ExpectedException.none(); private final MeterSdk testSdk = - new SdkMetricsProvider().create().get("io.opentelemetry.sdk.metrics.SdkLongCounterTest"); + new SdkMetricsProvider().create().get("io.opentelemetry.sdk.metrics.LongCounterSdkTest"); @Test public void testLongCounter() { LabelSet labelSet = testSdk.createLabelSet("K", "v"); LongCounter longCounter = - SdkLongCounter.Builder.builder("testCounter") + LongCounterSdk.Builder.builder("testCounter") .setConstantLabels(ImmutableMap.of("sk1", "sv1")) .setLabelKeys(Collections.singletonList("sk1")) .setDescription("My very own counter") @@ -64,7 +64,7 @@ public void testLongCounter() { @Test public void testLongCounter_monotonicity() { LongCounter longCounter = - SdkLongCounter.Builder.builder("testCounter").setMonotonic(true).build(); + LongCounterSdk.Builder.builder("testCounter").setMonotonic(true).build(); thrown.expect(IllegalArgumentException.class); longCounter.add(-45, testSdk.createLabelSet()); @@ -73,7 +73,7 @@ public void testLongCounter_monotonicity() { @Test public void testBoundLongCounter_monotonicity() { LongCounter longCounter = - SdkLongCounter.Builder.builder("testCounter").setMonotonic(true).build(); + LongCounterSdk.Builder.builder("testCounter").setMonotonic(true).build(); thrown.expect(IllegalArgumentException.class); longCounter.bind(testSdk.createLabelSet()).add(-9); diff --git a/sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkLongMeasureTest.java b/sdk/src/test/java/io/opentelemetry/sdk/metrics/LongMeasureSdkTest.java similarity index 89% rename from sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkLongMeasureTest.java rename to sdk/src/test/java/io/opentelemetry/sdk/metrics/LongMeasureSdkTest.java index 6845724954c..2426a19979d 100644 --- a/sdk/src/test/java/io/opentelemetry/sdk/metrics/SdkLongMeasureTest.java +++ b/sdk/src/test/java/io/opentelemetry/sdk/metrics/LongMeasureSdkTest.java @@ -29,20 +29,20 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Unit tests for {@link SdkLongMeasure}. */ +/** Unit tests for {@link LongMeasureSdk}. */ @RunWith(JUnit4.class) -public class SdkLongMeasureTest { +public class LongMeasureSdkTest { @Rule public ExpectedException thrown = ExpectedException.none(); private final MeterSdk testSdk = - new SdkMetricsProvider().create().get("io.opentelemetry.sdk.metrics.SdkLongMeasureTest"); + new SdkMetricsProvider().create().get("io.opentelemetry.sdk.metrics.LongMeasureSdkTest"); @Test public void testLongMeasure() { LabelSet labelSet = testSdk.createLabelSet("K", "v"); LongMeasure longMeasure = - SdkLongMeasure.Builder.builder("testMeasure") + LongMeasureSdk.Builder.builder("testMeasure") .setConstantLabels(ImmutableMap.of("sk1", "sv1")) .setLabelKeys(Collections.singletonList("sk1")) .setDescription("My very own measure") @@ -64,7 +64,7 @@ public void testLongMeasure() { @Test public void testLongMeasure_absolute() { LongMeasure longMeasure = - SdkLongMeasure.Builder.builder("testMeasure").setAbsolute(true).build(); + LongMeasureSdk.Builder.builder("testMeasure").setAbsolute(true).build(); thrown.expect(IllegalArgumentException.class); longMeasure.record(-45, testSdk.createLabelSet()); @@ -73,7 +73,7 @@ public void testLongMeasure_absolute() { @Test public void testBoundLongMeasure_absolute() { LongMeasure longMeasure = - SdkLongMeasure.Builder.builder("testMeasure").setAbsolute(true).build(); + LongMeasureSdk.Builder.builder("testMeasure").setAbsolute(true).build(); thrown.expect(IllegalArgumentException.class); longMeasure.bind(testSdk.createLabelSet()).record(-9); diff --git a/sdk/src/test/java/io/opentelemetry/sdk/metrics/MeterSdkTest.java b/sdk/src/test/java/io/opentelemetry/sdk/metrics/MeterSdkTest.java index 8b2c079f91b..bbc58cead61 100644 --- a/sdk/src/test/java/io/opentelemetry/sdk/metrics/MeterSdkTest.java +++ b/sdk/src/test/java/io/opentelemetry/sdk/metrics/MeterSdkTest.java @@ -20,7 +20,9 @@ import com.google.common.collect.ImmutableMap; import io.opentelemetry.metrics.DoubleCounter; +import io.opentelemetry.metrics.DoubleMeasure; import io.opentelemetry.metrics.LongCounter; +import io.opentelemetry.metrics.LongMeasure; import java.util.Collections; import org.junit.Test; import org.junit.runner.RunWith; @@ -44,7 +46,24 @@ public void testLongCounter() { .setMonotonic(true) .build(); assertThat(longCounter).isNotNull(); - assertThat(longCounter).isInstanceOf(SdkLongCounter.class); + assertThat(longCounter).isInstanceOf(LongCounterSdk.class); + + // todo: verify that the MeterSdk has kept track of what has been created, once that's in place + } + + @Test + public void testLongMeasure() { + LongMeasure longMeasure = + testSdk + .longMeasureBuilder("testCounter") + .setConstantLabels(ImmutableMap.of("sk1", "sv1")) + .setLabelKeys(Collections.singletonList("sk1")) + .setDescription("My very own counter") + .setUnit("metric tonnes") + .setAbsolute(true) + .build(); + assertThat(longMeasure).isNotNull(); + assertThat(longMeasure).isInstanceOf(LongMeasureSdk.class); // todo: verify that the MeterSdk has kept track of what has been created, once that's in place } @@ -61,7 +80,24 @@ public void testDoubleCounter() { .setMonotonic(true) .build(); assertThat(doubleCounter).isNotNull(); - assertThat(doubleCounter).isInstanceOf(SdkDoubleCounter.class); + assertThat(doubleCounter).isInstanceOf(DoubleCounterSdk.class); + + // todo: verify that the MeterSdk has kept track of what has been created, once that's in place + } + + @Test + public void testDoubleMeasure() { + DoubleMeasure doubleMeasure = + testSdk + .doubleMeasureBuilder("testMeasure") + .setConstantLabels(ImmutableMap.of("sk1", "sv1")) + .setLabelKeys(Collections.singletonList("sk1")) + .setDescription("My very own Measure") + .setUnit("metric tonnes") + .setAbsolute(true) + .build(); + assertThat(doubleMeasure).isNotNull(); + assertThat(doubleMeasure).isInstanceOf(DoubleMeasureSdk.class); // todo: verify that the MeterSdk has kept track of what has been created, once that's in place } From c6dedcb136df16cf071158e6ff80dc5bc79ed67c Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 30 Jan 2020 15:38:50 -0800 Subject: [PATCH 6/6] Rename SdkLabelSet to LabelSetSdk (#810) Signed-off-by: Bogdan Cristian Drutu --- .../sdk/metrics/{SdkLabelSet.java => LabelSetSdk.java} | 8 ++++---- .../main/java/io/opentelemetry/sdk/metrics/MeterSdk.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) rename sdk/src/main/java/io/opentelemetry/sdk/metrics/{SdkLabelSet.java => LabelSetSdk.java} (87%) diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkLabelSet.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/LabelSetSdk.java similarity index 87% rename from sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkLabelSet.java rename to sdk/src/main/java/io/opentelemetry/sdk/metrics/LabelSetSdk.java index 138ca189ef1..1278f720e0c 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/metrics/SdkLabelSet.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/LabelSetSdk.java @@ -26,15 +26,15 @@ import java.util.Map; @AutoValue -abstract class SdkLabelSet implements LabelSet { +abstract class LabelSetSdk implements LabelSet { private static final LabelSet EMPTY = - new AutoValue_SdkLabelSet(Collections.emptyMap()); + new AutoValue_LabelSetSdk(Collections.emptyMap()); static LabelSet create(Map labels) { if (labels == null || labels.isEmpty()) { return EMPTY; } - return new AutoValue_SdkLabelSet(unmodifiableMap(labels)); + return new AutoValue_LabelSetSdk(unmodifiableMap(labels)); } static LabelSet create(String... keyValuePairs) { @@ -49,7 +49,7 @@ static LabelSet create(String... keyValuePairs) { String key = keyValuePairs[i]; data.put(key, keyValuePairs[++i]); } - return new AutoValue_SdkLabelSet(Collections.unmodifiableMap(data)); + return new AutoValue_LabelSetSdk(Collections.unmodifiableMap(data)); } abstract Map getLabels(); diff --git a/sdk/src/main/java/io/opentelemetry/sdk/metrics/MeterSdk.java b/sdk/src/main/java/io/opentelemetry/sdk/metrics/MeterSdk.java index 9bf7b708357..f56793a4237 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/metrics/MeterSdk.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/metrics/MeterSdk.java @@ -95,11 +95,11 @@ public BatchRecorder newMeasureBatchRecorder() { @Override public LabelSet createLabelSet(String... keyValuePairs) { - return SdkLabelSet.create(keyValuePairs); + return LabelSetSdk.create(keyValuePairs); } @Override public LabelSet createLabelSet(Map labels) { - return SdkLabelSet.create(labels); + return LabelSetSdk.create(labels); } }