Skip to content

Commit 7f7a5b2

Browse files
authored
use stable semconv in tests (#1098)
* use stable semconv when we can * spotless
1 parent 5329a61 commit 7f7a5b2

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

custom/src/test/java/co/elastic/otel/ElasticAutoConfigurationCustomizerProviderTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
3232
import io.opentelemetry.sdk.metrics.export.MetricExporter;
3333
import io.opentelemetry.sdk.resources.Resource;
34+
import io.opentelemetry.semconv.DeploymentAttributes;
3435
import io.opentelemetry.semconv.incubating.DeploymentIncubatingAttributes;
3536
import java.util.HashMap;
3637
import java.util.List;
@@ -148,7 +149,7 @@ void legacyDeploymentEnvironment() {
148149
.hasSize(3)
149150
.describedAs("when legacy attribute set agent should send both")
150151
.containsEntry(DeploymentIncubatingAttributes.DEPLOYMENT_ENVIRONMENT, "test")
151-
.containsEntry(DeploymentIncubatingAttributes.DEPLOYMENT_ENVIRONMENT_NAME, "test")
152+
.containsEntry(DeploymentAttributes.DEPLOYMENT_ENVIRONMENT_NAME, "test")
152153
.containsEntry("other", "other");
153154
}
154155

@@ -157,15 +158,15 @@ void legacyDeploymentRemoveLegacyWhenBothSet() {
157158
Resource input =
158159
Resource.builder()
159160
.put(DeploymentIncubatingAttributes.DEPLOYMENT_ENVIRONMENT, "legacy")
160-
.put(DeploymentIncubatingAttributes.DEPLOYMENT_ENVIRONMENT_NAME, "new")
161+
.put(DeploymentAttributes.DEPLOYMENT_ENVIRONMENT_NAME, "new")
161162
.put("other", "other")
162163
.build();
163164
Resource resource = resourceProviders().apply(input, null);
164165
assertThat(resource.getAttributes())
165166
.hasSize(3)
166167
.describedAs("when both attributes are set, agent should send them as-is")
167168
.containsEntry(DeploymentIncubatingAttributes.DEPLOYMENT_ENVIRONMENT, "legacy")
168-
.containsEntry(DeploymentIncubatingAttributes.DEPLOYMENT_ENVIRONMENT_NAME, "new")
169+
.containsEntry(DeploymentAttributes.DEPLOYMENT_ENVIRONMENT_NAME, "new")
169170
.containsEntry("other", "other");
170171
}
171172
}

custom/src/test/java/co/elastic/otel/SpanStackTraceTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import io.opentelemetry.api.trace.Tracer;
3131
import io.opentelemetry.contrib.stacktrace.StackTraceSpanProcessor;
3232
import io.opentelemetry.sdk.trace.data.SpanData;
33-
import io.opentelemetry.semconv.incubating.CodeIncubatingAttributes;
33+
import io.opentelemetry.semconv.CodeAttributes;
3434
import java.util.List;
3535
import org.assertj.core.api.AbstractCharSequenceAssert;
3636
import org.junit.jupiter.api.AfterEach;
@@ -126,11 +126,9 @@ private void checkSpanStackTrace(boolean stackTraceExpected) {
126126
if (stackTraceExpected) {
127127
assertThat(span)
128128
.hasAttribute(
129-
satisfies(
130-
CodeIncubatingAttributes.CODE_STACKTRACE,
131-
AbstractCharSequenceAssert::isNotBlank));
129+
satisfies(CodeAttributes.CODE_STACKTRACE, AbstractCharSequenceAssert::isNotBlank));
132130
} else {
133-
assertThat(span.getAttributes().get(CodeIncubatingAttributes.CODE_STACKTRACE)).isNull();
131+
assertThat(span.getAttributes().get(CodeAttributes.CODE_STACKTRACE)).isNull();
134132
}
135133
}
136134

0 commit comments

Comments
 (0)