diff --git a/exporters/otlp/common/build.gradle.kts b/exporters/otlp/common/build.gradle.kts index 99b054f3d5e..0e74e8829a7 100644 --- a/exporters/otlp/common/build.gradle.kts +++ b/exporters/otlp/common/build.gradle.kts @@ -16,7 +16,6 @@ dependencies { protoSource("io.opentelemetry.proto:opentelemetry-proto:${versions["io.opentelemetry.proto"]}") api(project(":exporters:common")) - implementation(project(":api:incubator")) compileOnly(project(":sdk:metrics")) compileOnly(project(":sdk:trace")) @@ -32,6 +31,7 @@ dependencies { testImplementation("com.google.guava:guava") testImplementation("io.opentelemetry.proto:opentelemetry-proto") + jmhImplementation(project(":api:incubator")) jmhImplementation(project(":sdk:testing")) jmhImplementation("com.fasterxml.jackson.core:jackson-core") jmhImplementation("io.opentelemetry.proto:opentelemetry-proto") diff --git a/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/ValueBodyTest.java b/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/ValueBodyTest.java index cd5820bb974..954ba6bdb63 100644 --- a/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/ValueBodyTest.java +++ b/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/ValueBodyTest.java @@ -10,7 +10,6 @@ import io.opentelemetry.api.common.KeyValue; import io.opentelemetry.api.common.Value; import io.opentelemetry.api.common.ValueType; -import io.opentelemetry.api.incubator.logs.ExtendedLogRecordBuilder; import io.opentelemetry.api.logs.Logger; import io.opentelemetry.sdk.logs.export.SimpleLogRecordProcessor; import io.opentelemetry.sdk.testing.exporter.InMemoryLogRecordExporter; @@ -32,7 +31,7 @@ void valueBody() { Logger logger = provider.get(ValueBodyTest.class.getName()); // Value can be a primitive type, like a string, long, double, boolean - extendedLogRecordBuilder(logger).setBody(Value.of(1)).emit(); + logger.logRecordBuilder().setBody(Value.of(1)).emit(); assertThat(exporter.getFinishedLogRecordItems()) .hasSize(1) .satisfiesExactly( @@ -48,7 +47,8 @@ void valueBody() { exporter.reset(); // ...or a byte array of raw data - extendedLogRecordBuilder(logger) + logger + .logRecordBuilder() .setBody(Value.of("hello world".getBytes(StandardCharsets.UTF_8))) .emit(); assertThat(exporter.getFinishedLogRecordItems()) @@ -68,7 +68,8 @@ void valueBody() { exporter.reset(); // But most commonly it will be used to represent complex structured like a map - extendedLogRecordBuilder(logger) + logger + .logRecordBuilder() .setBody( // The protocol data structure uses a repeated KeyValue to represent a map: // https://github.com/open-telemetry/opentelemetry-proto/blob/ac3242b03157295e4ee9e616af53b81517b06559/opentelemetry/proto/common/v1/common.proto#L59 @@ -145,7 +146,8 @@ void valueBody() { exporter.reset(); // ..or an array (optionally with heterogeneous types) - extendedLogRecordBuilder(logger) + logger + .logRecordBuilder() .setBody(Value.of(Value.of("entry1"), Value.of("entry2"), Value.of(3))) .emit(); assertThat(exporter.getFinishedLogRecordItems()) @@ -164,8 +166,4 @@ void valueBody() { }); exporter.reset(); } - - ExtendedLogRecordBuilder extendedLogRecordBuilder(Logger logger) { - return (ExtendedLogRecordBuilder) logger.logRecordBuilder(); - } } 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 5aa8f49de31..d155a7d7975 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 @@ -96,8 +96,7 @@ public LongHistogramBuilder ofLongs() { } @Override - public ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice( - List bucketBoundaries) { + public DoubleHistogramBuilder setExplicitBucketBoundariesAdvice(List bucketBoundaries) { try { Objects.requireNonNull(bucketBoundaries, "bucketBoundaries must not be null"); ExplicitBucketHistogramUtils.validateBucketBoundaries(bucketBoundaries); 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 0822b1eff57..5e96bfb2e61 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 @@ -99,8 +99,7 @@ public SdkLongHistogram build() { } @Override - public ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice( - List bucketBoundaries) { + public LongHistogramBuilder setExplicitBucketBoundariesAdvice(List bucketBoundaries) { List boundaries; try { Objects.requireNonNull(bucketBoundaries, "bucketBoundaries must not be null"); 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 981d84dcd82..195c8730e45 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 @@ -8,7 +8,6 @@ import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import io.github.netmikey.logunit.api.LogCapturer; -import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder; import io.opentelemetry.internal.testing.slf4j.SuppressLogger; import io.opentelemetry.sdk.common.InstrumentationScopeInfo; import io.opentelemetry.sdk.metrics.internal.state.MetricStorageRegistry; @@ -222,13 +221,17 @@ 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")) + meterProvider + .get("meter1") + .histogramBuilder("histogram1") .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")) + meterProvider + .get("meter1") + .histogramBuilder("histogram2") .setExplicitBucketBoundariesAdvice(Arrays.asList(10.0, 20.0, 30.0)) .build() .record(8); diff --git a/sdk/testing/build.gradle.kts b/sdk/testing/build.gradle.kts index 4d3f3aa4ec8..e6a095179d5 100644 --- a/sdk/testing/build.gradle.kts +++ b/sdk/testing/build.gradle.kts @@ -8,7 +8,6 @@ otelJava.moduleName.set("io.opentelemetry.sdk.testing") dependencies { api(project(":api:all")) - api(project(":api:incubator")) api(project(":sdk:all")) compileOnly("org.assertj:assertj-core") @@ -17,6 +16,8 @@ dependencies { annotationProcessor("com.google.auto.value:auto-value") + testImplementation(project(":api:incubator")) + testImplementation("junit:junit") testImplementation("org.junit.vintage:junit-vintage-engine") }