Skip to content

Commit

Permalink
Remove unused dependencies, cleanup code after stability (#6948)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg authored Dec 12, 2024
1 parent f68ba65 commit b32f644
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion exporters/otlp/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand All @@ -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())
Expand All @@ -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
Expand Down Expand Up @@ -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())
Expand All @@ -164,8 +166,4 @@ void valueBody() {
});
exporter.reset();
}

ExtendedLogRecordBuilder extendedLogRecordBuilder(Logger logger) {
return (ExtendedLogRecordBuilder) logger.logRecordBuilder();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public LongHistogramBuilder ofLongs() {
}

@Override
public ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice(
List<Double> bucketBoundaries) {
public DoubleHistogramBuilder setExplicitBucketBoundariesAdvice(List<Double> bucketBoundaries) {
try {
Objects.requireNonNull(bucketBoundaries, "bucketBoundaries must not be null");
ExplicitBucketHistogramUtils.validateBucketBoundaries(bucketBoundaries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ public SdkLongHistogram build() {
}

@Override
public ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice(
List<Long> bucketBoundaries) {
public LongHistogramBuilder setExplicitBucketBoundariesAdvice(List<Long> bucketBoundaries) {
List<Double> boundaries;
try {
Objects.requireNonNull(bucketBoundaries, "bucketBoundaries must not be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion sdk/testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
}

0 comments on commit b32f644

Please sign in to comment.