From dd82b8427fcf7bd345d665dd2072446559bfeee1 Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Thu, 21 Sep 2023 14:32:52 -0500 Subject: [PATCH] Refactor advice API --- .../DoubleCounterAdviceConfigurer.java | 17 ---------------- .../metrics/DoubleGaugeAdviceConfigurer.java | 16 --------------- .../DoubleHistogramAdviceConfigurer.java | 20 ------------------- .../DoubleUpDownCounterAdviceConfigurer.java | 17 ---------------- .../metrics/ExtendedDoubleCounterBuilder.java | 10 +++++++--- .../metrics/ExtendedDoubleGaugeBuilder.java | 9 +++++++-- .../ExtendedDoubleHistogramBuilder.java | 20 +++++++++++++++---- .../ExtendedDoubleUpDownCounterBuilder.java | 11 ++++++---- .../metrics/ExtendedLongCounterBuilder.java | 10 +++++++--- .../metrics/ExtendedLongGaugeBuilder.java | 9 +++++++-- .../metrics/ExtendedLongHistogramBuilder.java | 19 +++++++++++++++--- .../ExtendedLongUpDownCounterBuilder.java | 11 ++++++---- .../metrics/LongCounterAdviceConfigurer.java | 17 ---------------- .../metrics/LongGaugeAdviceConfigurer.java | 16 --------------- .../LongHistogramAdviceConfigurer.java | 20 ------------------- .../LongUpDownCounterAdviceConfigurer.java | 17 ---------------- .../sdk/metrics/SdkDoubleCounter.java | 12 ++--------- .../sdk/metrics/SdkDoubleGauge.java | 12 ++--------- .../sdk/metrics/SdkDoubleHistogram.java | 15 +++----------- .../sdk/metrics/SdkDoubleUpDownCounter.java | 14 +++---------- .../sdk/metrics/SdkLongCounter.java | 12 ++--------- .../sdk/metrics/SdkLongGauge.java | 12 ++--------- .../sdk/metrics/SdkLongHistogram.java | 16 ++++----------- .../sdk/metrics/SdkLongUpDownCounter.java | 13 ++---------- .../sdk/metrics/AttributesAdviceTest.java | 16 +++++++-------- .../ExplicitBucketBoundariesAdviceTest.java | 9 ++------- .../sdk/metrics/IdentityTest.java | 4 ++-- 27 files changed, 106 insertions(+), 268 deletions(-) delete mode 100644 extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleCounterAdviceConfigurer.java delete mode 100644 extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleGaugeAdviceConfigurer.java delete mode 100644 extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleHistogramAdviceConfigurer.java delete mode 100644 extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleUpDownCounterAdviceConfigurer.java delete mode 100644 extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongCounterAdviceConfigurer.java delete mode 100644 extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongGaugeAdviceConfigurer.java delete mode 100644 extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongHistogramAdviceConfigurer.java delete mode 100644 extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongUpDownCounterAdviceConfigurer.java diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleCounterAdviceConfigurer.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleCounterAdviceConfigurer.java deleted file mode 100644 index 51c3a6c3447..00000000000 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleCounterAdviceConfigurer.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.extension.incubator.metrics; - -import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.metrics.DoubleCounter; -import java.util.List; - -/** Configure advice for implementation of {@link DoubleCounter}. */ -public interface DoubleCounterAdviceConfigurer { - - /** Specify the recommended set of attribute keys to be used for this counter. */ - DoubleCounterAdviceConfigurer setAttributes(List> attributes); -} diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleGaugeAdviceConfigurer.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleGaugeAdviceConfigurer.java deleted file mode 100644 index 3c99c1d6df5..00000000000 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleGaugeAdviceConfigurer.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.extension.incubator.metrics; - -import io.opentelemetry.api.common.AttributeKey; -import java.util.List; - -/** Configure advice for implementation of {@code DoubleGauge}. */ -public interface DoubleGaugeAdviceConfigurer { - - /** Specify the recommended set of attribute keys to be used for this gauge. */ - DoubleGaugeAdviceConfigurer setAttributes(List> attributes); -} diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleHistogramAdviceConfigurer.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleHistogramAdviceConfigurer.java deleted file mode 100644 index 404a3db9d16..00000000000 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleHistogramAdviceConfigurer.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.extension.incubator.metrics; - -import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.metrics.DoubleHistogram; -import java.util.List; - -/** Configure advice for implementations of {@link DoubleHistogram}. */ -public interface DoubleHistogramAdviceConfigurer { - - /** Specify recommended set of explicit bucket boundaries for this histogram. */ - DoubleHistogramAdviceConfigurer setExplicitBucketBoundaries(List bucketBoundaries); - - /** Specify the recommended set of attribute keys to be used for this histogram. */ - DoubleHistogramAdviceConfigurer setAttributes(List> attributes); -} diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleUpDownCounterAdviceConfigurer.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleUpDownCounterAdviceConfigurer.java deleted file mode 100644 index 06acffb4e3a..00000000000 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/DoubleUpDownCounterAdviceConfigurer.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.extension.incubator.metrics; - -import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.metrics.DoubleUpDownCounter; -import java.util.List; - -/** Configure advice for implementation of {@link DoubleUpDownCounter}. */ -public interface DoubleUpDownCounterAdviceConfigurer { - - /** Specify the recommended set of attribute keys to be used for this up down counter. */ - DoubleUpDownCounterAdviceConfigurer setAttributes(List> attributes); -} diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleCounterBuilder.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleCounterBuilder.java index a6bcc97a8c2..af295db6e63 100644 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleCounterBuilder.java +++ b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleCounterBuilder.java @@ -5,14 +5,18 @@ package io.opentelemetry.extension.incubator.metrics; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.metrics.DoubleCounterBuilder; -import java.util.function.Consumer; +import java.util.List; /** Extended {@link DoubleCounterBuilder} with experimental APIs. */ public interface ExtendedDoubleCounterBuilder extends DoubleCounterBuilder { - /** Specify advice for counter implementations. */ - default DoubleCounterBuilder setAdvice(Consumer adviceConsumer) { + /** + * Specify the attribute advice, which suggests the recommended set of attribute keys to be used + * for this counter. + */ + default ExtendedDoubleCounterBuilder setAttributesAdvice(List> attributes) { return this; } } diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleGaugeBuilder.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleGaugeBuilder.java index 208dba0c32f..0ee94b6522c 100644 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleGaugeBuilder.java +++ b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleGaugeBuilder.java @@ -5,7 +5,9 @@ package io.opentelemetry.extension.incubator.metrics; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.metrics.DoubleGaugeBuilder; +import java.util.List; import java.util.function.Consumer; /** Extended {@link DoubleGaugeBuilder} with experimental APIs. */ @@ -22,8 +24,11 @@ public interface ExtendedDoubleGaugeBuilder extends DoubleGaugeBuilder { */ DoubleGauge build(); - /** Specify advice for gauge implementations. */ - default DoubleGaugeBuilder setAdvice(Consumer adviceConsumer) { + /** + * Specify the attribute advice, which suggests the recommended set of attribute keys to be used + * for this gauge. + */ + default ExtendedDoubleGaugeBuilder setAttributesAdvice(List> attributes) { return this; } } diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleHistogramBuilder.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleHistogramBuilder.java index c48cf9420de..881727538c2 100644 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleHistogramBuilder.java +++ b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleHistogramBuilder.java @@ -5,15 +5,27 @@ package io.opentelemetry.extension.incubator.metrics; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.metrics.DoubleHistogramBuilder; -import java.util.function.Consumer; +import java.util.List; /** Extended {@link DoubleHistogramBuilder} with experimental APIs. */ public interface ExtendedDoubleHistogramBuilder extends DoubleHistogramBuilder { - /** Specify advice for histogram implementations. */ - default DoubleHistogramBuilder setAdvice( - Consumer adviceConsumer) { + /** + * Specify the explicit bucket buckets boundaries advice, which suggests the recommended set of + * explicit bucket boundaries for this histogram. + */ + default ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice( + List bucketBoundaries) { + return this; + } + + /** + * Specify the attribute advice, which suggests the recommended set of attribute keys to be used + * for this histogram. + */ + default ExtendedDoubleHistogramBuilder setAttributesAdvice(List> attributes) { return this; } } diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleUpDownCounterBuilder.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleUpDownCounterBuilder.java index b50e0e155db..9905f323d9a 100644 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleUpDownCounterBuilder.java +++ b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedDoubleUpDownCounterBuilder.java @@ -5,15 +5,18 @@ package io.opentelemetry.extension.incubator.metrics; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.metrics.DoubleUpDownCounterBuilder; -import java.util.function.Consumer; +import java.util.List; /** Extended {@link DoubleUpDownCounterBuilder} with experimental APIs. */ public interface ExtendedDoubleUpDownCounterBuilder extends DoubleUpDownCounterBuilder { - /** Specify advice for up down counter implementations. */ - default DoubleUpDownCounterBuilder setAdvice( - Consumer adviceConsumer) { + /** + * Specify the attribute advice, which suggests the recommended set of attribute keys to be used + * for this up down counter. + */ + default ExtendedDoubleUpDownCounterBuilder setAttributesAdvice(List> attributes) { return this; } } diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongCounterBuilder.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongCounterBuilder.java index 9171156d8ae..02bbf1b83e0 100644 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongCounterBuilder.java +++ b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongCounterBuilder.java @@ -5,14 +5,18 @@ package io.opentelemetry.extension.incubator.metrics; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.metrics.LongCounterBuilder; -import java.util.function.Consumer; +import java.util.List; /** Extended {@link LongCounterBuilder} with experimental APIs. */ public interface ExtendedLongCounterBuilder extends LongCounterBuilder { - /** Specify advice for counter implementations. */ - default LongCounterBuilder setAdvice(Consumer adviceConsumer) { + /** + * Specify the attribute advice, which suggests the recommended set of attribute keys to be used + * for this counter. + */ + default ExtendedLongCounterBuilder setAttributesAdvice(List> attributes) { return this; } } diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongGaugeBuilder.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongGaugeBuilder.java index 1c42952834f..e1ca168f10b 100644 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongGaugeBuilder.java +++ b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongGaugeBuilder.java @@ -5,7 +5,9 @@ package io.opentelemetry.extension.incubator.metrics; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.metrics.LongGaugeBuilder; +import java.util.List; import java.util.function.Consumer; /** Extended {@link LongGaugeBuilder} with experimental APIs. */ @@ -22,8 +24,11 @@ public interface ExtendedLongGaugeBuilder extends LongGaugeBuilder { */ LongGauge build(); - /** Specify advice for gauge implementations. */ - default LongGaugeBuilder setAdvice(Consumer adviceConsumer) { + /** + * Specify the attribute advice, which suggests the recommended set of attribute keys to be used + * for this gauge. + */ + default ExtendedLongGaugeBuilder setAttributesAdvice(List> attributes) { return this; } } diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongHistogramBuilder.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongHistogramBuilder.java index 211c86fe7cd..665e4e3555e 100644 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongHistogramBuilder.java +++ b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongHistogramBuilder.java @@ -5,14 +5,27 @@ package io.opentelemetry.extension.incubator.metrics; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.metrics.LongHistogramBuilder; -import java.util.function.Consumer; +import java.util.List; /** Extended {@link LongHistogramBuilder} with experimental APIs. */ public interface ExtendedLongHistogramBuilder extends LongHistogramBuilder { - /** Specify advice for histogram implementations. */ - default LongHistogramBuilder setAdvice(Consumer adviceConsumer) { + /** + * Specify the explicit bucket buckets boundaries advice, which suggests the recommended set of + * explicit bucket boundaries for this histogram. + */ + default ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice( + List bucketBoundaries) { + return this; + } + + /** + * Specify the attribute advice, which suggests the recommended set of attribute keys to be used + * for this histogram. + */ + default ExtendedLongHistogramBuilder setAttributesAdvice(List> attributes) { return this; } } diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongUpDownCounterBuilder.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongUpDownCounterBuilder.java index 75cb286376e..0d0ae2781ee 100644 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongUpDownCounterBuilder.java +++ b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/ExtendedLongUpDownCounterBuilder.java @@ -5,15 +5,18 @@ package io.opentelemetry.extension.incubator.metrics; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.metrics.LongUpDownCounterBuilder; -import java.util.function.Consumer; +import java.util.List; /** Extended {@link LongUpDownCounterBuilder} with experimental APIs. */ public interface ExtendedLongUpDownCounterBuilder extends LongUpDownCounterBuilder { - /** Specify advice for up down counter implementations. */ - default LongUpDownCounterBuilder setAdvice( - Consumer adviceConsumer) { + /** + * Specify the attribute advice, which suggests the recommended set of attribute keys to be used + * for this up down counter. + */ + default ExtendedLongUpDownCounterBuilder setAttributesAdvice(List> attributes) { return this; } } diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongCounterAdviceConfigurer.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongCounterAdviceConfigurer.java deleted file mode 100644 index 3a0e9bbe70d..00000000000 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongCounterAdviceConfigurer.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.extension.incubator.metrics; - -import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.metrics.LongCounter; -import java.util.List; - -/** Configure advice for implementation of {@link LongCounter}. */ -public interface LongCounterAdviceConfigurer { - - /** Specify the recommended set of attribute keys to be used for this counter. */ - LongCounterAdviceConfigurer setAttributes(List> attributes); -} diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongGaugeAdviceConfigurer.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongGaugeAdviceConfigurer.java deleted file mode 100644 index c424a878971..00000000000 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongGaugeAdviceConfigurer.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.extension.incubator.metrics; - -import io.opentelemetry.api.common.AttributeKey; -import java.util.List; - -/** Configure advice for implementation of {@code LongGauge}. */ -public interface LongGaugeAdviceConfigurer { - - /** Specify the recommended set of attribute keys to be used for this gauge. */ - LongGaugeAdviceConfigurer setAttributes(List> attributes); -} diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongHistogramAdviceConfigurer.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongHistogramAdviceConfigurer.java deleted file mode 100644 index 0c5fc91ad27..00000000000 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongHistogramAdviceConfigurer.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.extension.incubator.metrics; - -import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.metrics.LongHistogram; -import java.util.List; - -/** Configure advice for implementations of {@link LongHistogram}. */ -public interface LongHistogramAdviceConfigurer { - - /** Specify recommended set of explicit bucket boundaries for this histogram. */ - LongHistogramAdviceConfigurer setExplicitBucketBoundaries(List bucketBoundaries); - - /** Specify the recommended set of attribute keys to be used for this histogram. */ - LongHistogramAdviceConfigurer setAttributes(List> attributes); -} diff --git a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongUpDownCounterAdviceConfigurer.java b/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongUpDownCounterAdviceConfigurer.java deleted file mode 100644 index 5090a824997..00000000000 --- a/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics/LongUpDownCounterAdviceConfigurer.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.extension.incubator.metrics; - -import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.metrics.LongUpDownCounter; -import java.util.List; - -/** Configure advice for implementation of {@link LongUpDownCounter}. */ -public interface LongUpDownCounterAdviceConfigurer { - - /** Specify the recommended set of attribute keys to be used for this up down counter. */ - LongUpDownCounterAdviceConfigurer setAttributes(List> attributes); -} diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleCounter.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleCounter.java index 04372eeb886..1b54f8a623d 100644 --- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleCounter.java +++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleCounter.java @@ -8,11 +8,9 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.metrics.DoubleCounter; -import io.opentelemetry.api.metrics.DoubleCounterBuilder; import io.opentelemetry.api.metrics.ObservableDoubleCounter; import io.opentelemetry.api.metrics.ObservableDoubleMeasurement; import io.opentelemetry.context.Context; -import io.opentelemetry.extension.incubator.metrics.DoubleCounterAdviceConfigurer; import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleCounterBuilder; import io.opentelemetry.sdk.internal.ThrottlingLogger; import io.opentelemetry.sdk.metrics.internal.descriptor.Advice; @@ -61,7 +59,7 @@ public void add(double increment) { static final class SdkDoubleCounterBuilder extends AbstractInstrumentBuilder - implements ExtendedDoubleCounterBuilder, DoubleCounterAdviceConfigurer { + implements ExtendedDoubleCounterBuilder { SdkDoubleCounterBuilder( MeterProviderSharedState meterProviderSharedState, @@ -86,12 +84,6 @@ protected SdkDoubleCounterBuilder getThis() { return this; } - @Override - public DoubleCounterBuilder setAdvice(Consumer adviceConsumer) { - adviceConsumer.accept(this); - return this; - } - @Override public SdkDoubleCounter build() { return buildSynchronousInstrument(SdkDoubleCounter::new); @@ -109,7 +101,7 @@ public ObservableDoubleMeasurement buildObserver() { } @Override - public DoubleCounterAdviceConfigurer setAttributes(List> attributes) { + public ExtendedDoubleCounterBuilder setAttributesAdvice(List> attributes) { adviceBuilder.setAttributes(attributes); return this; } diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleGauge.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleGauge.java index a7456008da4..008745b2652 100644 --- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleGauge.java +++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleGauge.java @@ -7,13 +7,11 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; -import io.opentelemetry.api.metrics.DoubleGaugeBuilder; import io.opentelemetry.api.metrics.LongGaugeBuilder; import io.opentelemetry.api.metrics.ObservableDoubleGauge; import io.opentelemetry.api.metrics.ObservableDoubleMeasurement; import io.opentelemetry.context.Context; import io.opentelemetry.extension.incubator.metrics.DoubleGauge; -import io.opentelemetry.extension.incubator.metrics.DoubleGaugeAdviceConfigurer; import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleGaugeBuilder; import io.opentelemetry.sdk.metrics.internal.descriptor.InstrumentDescriptor; import io.opentelemetry.sdk.metrics.internal.state.MeterProviderSharedState; @@ -42,7 +40,7 @@ public void set(double increment) { } static final class SdkDoubleGaugeBuilder extends AbstractInstrumentBuilder - implements ExtendedDoubleGaugeBuilder, DoubleGaugeAdviceConfigurer { + implements ExtendedDoubleGaugeBuilder { SdkDoubleGaugeBuilder( MeterProviderSharedState meterProviderSharedState, @@ -70,13 +68,7 @@ public SdkDoubleGauge build() { } @Override - public DoubleGaugeBuilder setAdvice(Consumer adviceConsumer) { - adviceConsumer.accept(this); - return this; - } - - @Override - public DoubleGaugeAdviceConfigurer setAttributes(List> attributes) { + public ExtendedDoubleGaugeBuilder setAttributesAdvice(List> attributes) { adviceBuilder.setAttributes(attributes); return this; } diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleHistogram.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleHistogram.java index e9b671a3d6e..c2e8d9b4126 100644 --- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleHistogram.java +++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleHistogram.java @@ -10,7 +10,6 @@ import io.opentelemetry.api.metrics.DoubleHistogram; import io.opentelemetry.api.metrics.LongHistogramBuilder; import io.opentelemetry.context.Context; -import io.opentelemetry.extension.incubator.metrics.DoubleHistogramAdviceConfigurer; import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder; import io.opentelemetry.sdk.internal.ThrottlingLogger; import io.opentelemetry.sdk.metrics.internal.descriptor.InstrumentDescriptor; @@ -18,7 +17,6 @@ import io.opentelemetry.sdk.metrics.internal.state.MeterSharedState; import io.opentelemetry.sdk.metrics.internal.state.WriteableMetricStorage; import java.util.List; -import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; @@ -58,7 +56,7 @@ public void record(double value) { static final class SdkDoubleHistogramBuilder extends AbstractInstrumentBuilder - implements ExtendedDoubleHistogramBuilder, DoubleHistogramAdviceConfigurer { + implements ExtendedDoubleHistogramBuilder { SdkDoubleHistogramBuilder( MeterProviderSharedState meterProviderSharedState, @@ -79,13 +77,6 @@ protected SdkDoubleHistogramBuilder getThis() { return this; } - @Override - public SdkDoubleHistogramBuilder setAdvice( - Consumer adviceConsumer) { - adviceConsumer.accept(this); - return this; - } - @Override public SdkDoubleHistogram build() { return buildSynchronousInstrument(SdkDoubleHistogram::new); @@ -97,14 +88,14 @@ public LongHistogramBuilder ofLongs() { } @Override - public DoubleHistogramAdviceConfigurer setExplicitBucketBoundaries( + public ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice( List bucketBoundaries) { adviceBuilder.setExplicitBucketBoundaries(bucketBoundaries); return this; } @Override - public DoubleHistogramAdviceConfigurer setAttributes(List> attributes) { + public ExtendedDoubleHistogramBuilder setAttributesAdvice(List> attributes) { adviceBuilder.setAttributes(attributes); return this; } diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleUpDownCounter.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleUpDownCounter.java index 22a6b68b6e3..a11fd3f2f61 100644 --- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleUpDownCounter.java +++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleUpDownCounter.java @@ -8,11 +8,9 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.metrics.DoubleUpDownCounter; -import io.opentelemetry.api.metrics.DoubleUpDownCounterBuilder; import io.opentelemetry.api.metrics.ObservableDoubleMeasurement; import io.opentelemetry.api.metrics.ObservableDoubleUpDownCounter; import io.opentelemetry.context.Context; -import io.opentelemetry.extension.incubator.metrics.DoubleUpDownCounterAdviceConfigurer; import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleUpDownCounterBuilder; import io.opentelemetry.sdk.metrics.internal.descriptor.Advice; import io.opentelemetry.sdk.metrics.internal.descriptor.InstrumentDescriptor; @@ -48,7 +46,7 @@ public void add(double increment) { static final class SdkDoubleUpDownCounterBuilder extends AbstractInstrumentBuilder - implements ExtendedDoubleUpDownCounterBuilder, DoubleUpDownCounterAdviceConfigurer { + implements ExtendedDoubleUpDownCounterBuilder { SdkDoubleUpDownCounterBuilder( MeterProviderSharedState meterProviderSharedState, @@ -73,13 +71,6 @@ protected SdkDoubleUpDownCounterBuilder getThis() { return this; } - @Override - public DoubleUpDownCounterBuilder setAdvice( - Consumer adviceConsumer) { - adviceConsumer.accept(this); - return this; - } - @Override public DoubleUpDownCounter build() { return buildSynchronousInstrument(SdkDoubleUpDownCounter::new); @@ -98,7 +89,8 @@ public ObservableDoubleMeasurement buildObserver() { } @Override - public DoubleUpDownCounterAdviceConfigurer setAttributes(List> attributes) { + public ExtendedDoubleUpDownCounterBuilder setAttributesAdvice( + List> attributes) { adviceBuilder.setAttributes(attributes); return this; } diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongCounter.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongCounter.java index dcdca53858a..58383d9e783 100644 --- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongCounter.java +++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongCounter.java @@ -9,12 +9,10 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.metrics.DoubleCounterBuilder; import io.opentelemetry.api.metrics.LongCounter; -import io.opentelemetry.api.metrics.LongCounterBuilder; import io.opentelemetry.api.metrics.ObservableLongCounter; import io.opentelemetry.api.metrics.ObservableLongMeasurement; import io.opentelemetry.context.Context; import io.opentelemetry.extension.incubator.metrics.ExtendedLongCounterBuilder; -import io.opentelemetry.extension.incubator.metrics.LongCounterAdviceConfigurer; import io.opentelemetry.sdk.internal.ThrottlingLogger; import io.opentelemetry.sdk.metrics.internal.descriptor.InstrumentDescriptor; import io.opentelemetry.sdk.metrics.internal.state.MeterProviderSharedState; @@ -61,7 +59,7 @@ public void add(long increment) { } static final class SdkLongCounterBuilder extends AbstractInstrumentBuilder - implements ExtendedLongCounterBuilder, LongCounterAdviceConfigurer { + implements ExtendedLongCounterBuilder { SdkLongCounterBuilder( MeterProviderSharedState meterProviderSharedState, @@ -82,12 +80,6 @@ protected SdkLongCounterBuilder getThis() { return this; } - @Override - public LongCounterBuilder setAdvice(Consumer adviceConsumer) { - adviceConsumer.accept(this); - return this; - } - @Override public SdkLongCounter build() { return buildSynchronousInstrument(SdkLongCounter::new); @@ -109,7 +101,7 @@ public ObservableLongMeasurement buildObserver() { } @Override - public LongCounterAdviceConfigurer setAttributes(List> attributes) { + public ExtendedLongCounterBuilder setAttributesAdvice(List> attributes) { adviceBuilder.setAttributes(attributes); return this; } diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongGauge.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongGauge.java index 475f80bba1f..24e6be8e6a5 100644 --- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongGauge.java +++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongGauge.java @@ -7,13 +7,11 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; -import io.opentelemetry.api.metrics.LongGaugeBuilder; import io.opentelemetry.api.metrics.ObservableLongGauge; import io.opentelemetry.api.metrics.ObservableLongMeasurement; import io.opentelemetry.context.Context; import io.opentelemetry.extension.incubator.metrics.ExtendedLongGaugeBuilder; import io.opentelemetry.extension.incubator.metrics.LongGauge; -import io.opentelemetry.extension.incubator.metrics.LongGaugeAdviceConfigurer; import io.opentelemetry.sdk.metrics.internal.descriptor.Advice; import io.opentelemetry.sdk.metrics.internal.descriptor.InstrumentDescriptor; import io.opentelemetry.sdk.metrics.internal.state.MeterProviderSharedState; @@ -42,7 +40,7 @@ public void set(long increment) { } static final class SdkLongGaugeBuilder extends AbstractInstrumentBuilder - implements ExtendedLongGaugeBuilder, LongGaugeAdviceConfigurer { + implements ExtendedLongGaugeBuilder { SdkLongGaugeBuilder( MeterProviderSharedState meterProviderSharedState, @@ -74,13 +72,7 @@ public SdkLongGauge build() { } @Override - public LongGaugeBuilder setAdvice(Consumer adviceConsumer) { - adviceConsumer.accept(this); - return this; - } - - @Override - public LongGaugeAdviceConfigurer setAttributes(List> attributes) { + public ExtendedLongGaugeBuilder setAttributesAdvice(List> attributes) { adviceBuilder.setAttributes(attributes); return this; } diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongHistogram.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongHistogram.java index 5e0d33b6578..c087a0c282e 100644 --- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongHistogram.java +++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongHistogram.java @@ -10,7 +10,6 @@ import io.opentelemetry.api.metrics.LongHistogram; import io.opentelemetry.context.Context; import io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder; -import io.opentelemetry.extension.incubator.metrics.LongHistogramAdviceConfigurer; import io.opentelemetry.sdk.internal.ThrottlingLogger; import io.opentelemetry.sdk.metrics.internal.descriptor.Advice; import io.opentelemetry.sdk.metrics.internal.descriptor.InstrumentDescriptor; @@ -18,7 +17,6 @@ import io.opentelemetry.sdk.metrics.internal.state.MeterSharedState; import io.opentelemetry.sdk.metrics.internal.state.WriteableMetricStorage; import java.util.List; -import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; @@ -59,7 +57,7 @@ public void record(long value) { static final class SdkLongHistogramBuilder extends AbstractInstrumentBuilder - implements ExtendedLongHistogramBuilder, LongHistogramAdviceConfigurer { + implements ExtendedLongHistogramBuilder { SdkLongHistogramBuilder( MeterProviderSharedState meterProviderSharedState, @@ -84,20 +82,14 @@ protected SdkLongHistogramBuilder getThis() { return this; } - @Override - public SdkLongHistogramBuilder setAdvice( - Consumer adviceConsumer) { - adviceConsumer.accept(this); - return this; - } - @Override public SdkLongHistogram build() { return buildSynchronousInstrument(SdkLongHistogram::new); } @Override - public LongHistogramAdviceConfigurer setExplicitBucketBoundaries(List bucketBoundaries) { + public ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice( + List bucketBoundaries) { List doubleBoundaries = bucketBoundaries.stream().map(Long::doubleValue).collect(Collectors.toList()); adviceBuilder.setExplicitBucketBoundaries(doubleBoundaries); @@ -105,7 +97,7 @@ public LongHistogramAdviceConfigurer setExplicitBucketBoundaries(List buck } @Override - public LongHistogramAdviceConfigurer setAttributes(List> attributes) { + public ExtendedLongHistogramBuilder setAttributesAdvice(List> attributes) { adviceBuilder.setAttributes(attributes); return this; } diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongUpDownCounter.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongUpDownCounter.java index 7c167acc28f..4351b28e5ce 100644 --- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongUpDownCounter.java +++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkLongUpDownCounter.java @@ -9,12 +9,10 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.metrics.DoubleUpDownCounterBuilder; import io.opentelemetry.api.metrics.LongUpDownCounter; -import io.opentelemetry.api.metrics.LongUpDownCounterBuilder; import io.opentelemetry.api.metrics.ObservableLongMeasurement; import io.opentelemetry.api.metrics.ObservableLongUpDownCounter; import io.opentelemetry.context.Context; import io.opentelemetry.extension.incubator.metrics.ExtendedLongUpDownCounterBuilder; -import io.opentelemetry.extension.incubator.metrics.LongUpDownCounterAdviceConfigurer; import io.opentelemetry.sdk.metrics.internal.descriptor.InstrumentDescriptor; import io.opentelemetry.sdk.metrics.internal.state.MeterProviderSharedState; import io.opentelemetry.sdk.metrics.internal.state.MeterSharedState; @@ -48,7 +46,7 @@ public void add(long increment) { static final class SdkLongUpDownCounterBuilder extends AbstractInstrumentBuilder - implements ExtendedLongUpDownCounterBuilder, LongUpDownCounterAdviceConfigurer { + implements ExtendedLongUpDownCounterBuilder { SdkLongUpDownCounterBuilder( MeterProviderSharedState meterProviderSharedState, @@ -69,13 +67,6 @@ protected SdkLongUpDownCounterBuilder getThis() { return this; } - @Override - public LongUpDownCounterBuilder setAdvice( - Consumer adviceConsumer) { - adviceConsumer.accept(this); - return this; - } - @Override public LongUpDownCounter build() { return buildSynchronousInstrument(SdkLongUpDownCounter::new); @@ -99,7 +90,7 @@ public ObservableLongMeasurement buildObserver() { } @Override - public LongUpDownCounterAdviceConfigurer setAttributes(List> attributes) { + public ExtendedLongUpDownCounterBuilder setAttributesAdvice(List> attributes) { adviceBuilder.setAttributes(attributes); return this; } diff --git a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/AttributesAdviceTest.java b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/AttributesAdviceTest.java index efc1aff53f5..0e673021556 100644 --- a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/AttributesAdviceTest.java +++ b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/AttributesAdviceTest.java @@ -153,7 +153,7 @@ public Stream provideArguments(ExtensionContext context) { meterProvider.get("meter").counterBuilder(name).ofDoubles(); if (attributesAdvice != null) { ((ExtendedDoubleCounterBuilder) doubleCounterBuilder) - .setAdvice(advice -> advice.setAttributes(attributesAdvice)); + .setAttributesAdvice(attributesAdvice); } DoubleCounter counter = doubleCounterBuilder.build(); return counter::add; @@ -170,7 +170,7 @@ public Stream provideArguments(ExtensionContext context) { meterProvider.get("meter").counterBuilder(name); if (attributesAdvice != null) { ((ExtendedLongCounterBuilder) doubleCounterBuilder) - .setAdvice(advice -> advice.setAttributes(attributesAdvice)); + .setAttributesAdvice(attributesAdvice); } LongCounter counter = doubleCounterBuilder.build(); return counter::add; @@ -187,7 +187,7 @@ public Stream provideArguments(ExtensionContext context) { meterProvider.get("meter").gaugeBuilder(name); if (attributesAdvice != null) { ((ExtendedDoubleGaugeBuilder) doubleGaugeBuilder) - .setAdvice(advice -> advice.setAttributes(attributesAdvice)); + .setAttributesAdvice(attributesAdvice); } AtomicDouble valueRef = new AtomicDouble(); AtomicReference attributesRef = new AtomicReference<>(); @@ -211,7 +211,7 @@ public Stream provideArguments(ExtensionContext context) { meterProvider.get("meter").gaugeBuilder(name).ofLongs(); if (attributesAdvice != null) { ((ExtendedLongGaugeBuilder) doubleGaugeBuilder) - .setAdvice(advice -> advice.setAttributes(attributesAdvice)); + .setAttributesAdvice(attributesAdvice); } AtomicLong valueRef = new AtomicLong(); AtomicReference attributesRef = new AtomicReference<>(); @@ -235,7 +235,7 @@ public Stream provideArguments(ExtensionContext context) { meterProvider.get("meter").histogramBuilder(name); if (attributesAdvice != null) { ((ExtendedDoubleHistogramBuilder) doubleHistogramBuilder) - .setAdvice(advice -> advice.setAttributes(attributesAdvice)); + .setAttributesAdvice(attributesAdvice); } DoubleHistogram histogram = doubleHistogramBuilder.build(); return histogram::record; @@ -252,7 +252,7 @@ public Stream provideArguments(ExtensionContext context) { meterProvider.get("meter").histogramBuilder(name).ofLongs(); if (attributesAdvice != null) { ((ExtendedLongHistogramBuilder) doubleHistogramBuilder) - .setAdvice(advice -> advice.setAttributes(attributesAdvice)); + .setAttributesAdvice(attributesAdvice); } LongHistogram histogram = doubleHistogramBuilder.build(); return histogram::record; @@ -269,7 +269,7 @@ public Stream provideArguments(ExtensionContext context) { meterProvider.get("meter").upDownCounterBuilder(name).ofDoubles(); if (attributesAdvice != null) { ((ExtendedDoubleUpDownCounterBuilder) doubleUpDownCounterBuilder) - .setAdvice(advice -> advice.setAttributes(attributesAdvice)); + .setAttributesAdvice(attributesAdvice); } DoubleUpDownCounter upDownCounter = doubleUpDownCounterBuilder.build(); return upDownCounter::add; @@ -286,7 +286,7 @@ public Stream provideArguments(ExtensionContext context) { meterProvider.get("meter").upDownCounterBuilder(name); if (attributesAdvice != null) { ((ExtendedLongUpDownCounterBuilder) doubleUpDownCounterBuilder) - .setAdvice(advice -> advice.setAttributes(attributesAdvice)); + .setAttributesAdvice(attributesAdvice); } LongUpDownCounter upDownCounter = doubleUpDownCounterBuilder.build(); return upDownCounter::add; diff --git a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/ExplicitBucketBoundariesAdviceTest.java b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/ExplicitBucketBoundariesAdviceTest.java index e25eb098e9e..555f852df1d 100644 --- a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/ExplicitBucketBoundariesAdviceTest.java +++ b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/ExplicitBucketBoundariesAdviceTest.java @@ -179,10 +179,7 @@ private static Stream histogramsWithAdvice() { DoubleHistogram build = ((ExtendedDoubleHistogramBuilder) meterProvider.get("meter").histogramBuilder("histogram")) - .setAdvice( - advice -> - advice.setExplicitBucketBoundaries( - Arrays.asList(10.0, 20.0, 30.0))) + .setExplicitBucketBoundariesAdvice(Arrays.asList(10.0, 20.0, 30.0)) .build(); return build::record; }), @@ -192,9 +189,7 @@ private static Stream histogramsWithAdvice() { LongHistogram build = ((ExtendedLongHistogramBuilder) meterProvider.get("meter").histogramBuilder("histogram").ofLongs()) - .setAdvice( - advice -> - advice.setExplicitBucketBoundaries(Arrays.asList(10L, 20L, 30L))) + .setExplicitBucketBoundariesAdvice(Arrays.asList(10L, 20L, 30L)) .build(); return build::record; })); diff --git a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/IdentityTest.java b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/IdentityTest.java index 9982e2e439b..7332e3d0dba 100644 --- a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/IdentityTest.java +++ b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/IdentityTest.java @@ -223,13 +223,13 @@ void sameMeterSameInstrumentNameDifferentNonIdentifyingFieldsNoViews() { // Register histogram1, with and without advice. First registration without advice wins. meterProvider.get("meter1").histogramBuilder("histogram1").build().record(8); ((ExtendedDoubleHistogramBuilder) meterProvider.get("meter1").histogramBuilder("histogram1")) - .setAdvice(advice -> advice.setExplicitBucketBoundaries(Arrays.asList(10.0, 20.0, 30.0))) + .setExplicitBucketBoundariesAdvice(Arrays.asList(10.0, 20.0, 30.0)) .build() .record(8); // Register histogram2, with and without advice. First registration with advice wins. ((ExtendedDoubleHistogramBuilder) meterProvider.get("meter1").histogramBuilder("histogram2")) - .setAdvice(advice -> advice.setExplicitBucketBoundaries(Arrays.asList(10.0, 20.0, 30.0))) + .setExplicitBucketBoundariesAdvice(Arrays.asList(10.0, 20.0, 30.0)) .build() .record(8); meterProvider.get("meter1").histogramBuilder("histogram2").build().record(8);