Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
`java-platform`
}

val otelInstrumentationVersion = "2.25.0-alpha"
val otelInstrumentationVersion = "2.26.0-alpha"
val semconvVersion = "1.40.0"

javaPlatform {
Expand Down
1 change: 0 additions & 1 deletion disk-buffering/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ val protos by configurations.creating

dependencies {
api("io.opentelemetry:opentelemetry-sdk")
implementation("io.opentelemetry:opentelemetry-api-incubator")
implementation("io.opentelemetry:opentelemetry-exporter-otlp-common")
compileOnly("com.google.auto.value:auto-value-annotations")
annotationProcessor("com.google.auto.value:auto-value")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@
import com.google.auto.value.AutoValue;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.Value;
import io.opentelemetry.api.incubator.common.ExtendedAttributes;
import io.opentelemetry.api.logs.Severity;
import io.opentelemetry.api.trace.SpanContext;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.logs.data.Body;
import io.opentelemetry.sdk.logs.data.internal.ExtendedLogRecordData;
import io.opentelemetry.sdk.logs.data.LogRecordData;
import io.opentelemetry.sdk.resources.Resource;
import javax.annotation.Nullable;

@AutoValue
public abstract class LogRecordDataImpl implements ExtendedLogRecordData {
public abstract class LogRecordDataImpl implements LogRecordData {

public static Builder builder() {
return new AutoValue_LogRecordDataImpl.Builder();
Expand All @@ -30,14 +29,6 @@ public Body getBody() {
return valueBody == null ? Body.empty() : Body.string(valueBody.asString());
}

@Override
public ExtendedAttributes getExtendedAttributes() {
return ExtendedAttributes.builder().putAll(getAttributes()).build();
}

// It's only deprecated in the incubating interface for extended attributes, which are not yet
// supported in this module.
@SuppressWarnings("deprecation")
@Override
public abstract Attributes getAttributes();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -155,7 +156,7 @@ void verifyIntegration_defaultAutoDelete() throws InterruptedException {

assertThat(storedSpans).hasSize(2);
assertThat(storedLogs).hasSize(2);
assertThat(storedMetrics).hasSize(2);
assertThat(filterTestMetrics(storedMetrics)).hasSize(2);

// Data is auto-deleted from disk
assertDirectoryFileCount(spansDir, 0);
Expand Down Expand Up @@ -198,7 +199,7 @@ void verifyIntegration_withoutAutoDelete() throws InterruptedException {

assertThat(storedSpans).hasSize(2);
assertThat(storedLogs).hasSize(2);
assertThat(storedMetrics).hasSize(2);
assertThat(filterTestMetrics(storedMetrics)).hasSize(2);

// Data stays on disk
assertDirectoryFileCount(spansDir, 2);
Expand Down Expand Up @@ -253,7 +254,7 @@ void verifyIntegration_withoutAutoDelete_explicitRemove() throws InterruptedExce

assertThat(storedSpans).hasSize(2);
assertThat(storedLogs).hasSize(2);
assertThat(storedMetrics).hasSize(2);
assertThat(filterTestMetrics(storedMetrics)).hasSize(2);

// Data explicitly cleared
assertDirectoryFileCount(spansDir, 0);
Expand Down Expand Up @@ -284,6 +285,23 @@ private void createMetric() {
clearInvocations(metricCallback);
}

private static final String TEST_METRIC_INSTRUMENTATION_SCOPE_NAME = "MetricInstrumentationScope";

/**
* Filters out upstream's self-instrumentation metrics (e.g. {@code
* otel.sdk.metric_reader.collection.duration}) that {@link PeriodicMetricReader} automatically
* records, returning only metrics from the test's instrumentation scope.
*/
private static List<MetricData> filterTestMetrics(List<MetricData> metrics) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed after these changes: open-telemetry/opentelemetry-java#8038

return metrics.stream()
.filter(
m ->
m.getInstrumentationScopeInfo()
.getName()
.equals(TEST_METRIC_INSTRUMENTATION_SCOPE_NAME))
.collect(Collectors.toList());
}

private static void assertDirectoryFileCount(File directory, int fileCount) {
assertThat(directory).isDirectory();
assertThat(directory.listFiles()).hasSize(fileCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.opentelemetry.api.trace.TracerProvider;
import io.opentelemetry.context.Context;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;

enum NoopTracerProvider implements TracerProvider {
INSTANCE;
Expand Down Expand Up @@ -62,7 +63,7 @@ public SpanBuilder addLink(SpanContext spanContext, Attributes attributes) {
}

@Override
public SpanBuilder setAttribute(String key, String value) {
public SpanBuilder setAttribute(String key, @Nullable String value) {
return this;
}

Expand All @@ -82,7 +83,7 @@ public SpanBuilder setAttribute(String key, boolean value) {
}

@Override
public <T> SpanBuilder setAttribute(AttributeKey<T> key, T value) {
public <T> SpanBuilder setAttribute(AttributeKey<T> key, @Nullable T value) {
return this;
}

Expand Down
Loading