Skip to content

Commit d764d1f

Browse files
build: bump io.opentelemetry.semconv:opentelemetry-semconv from 1.29.0-alpha to 1.30.0-rc.1 (#3966)
* build: bump io.opentelemetry.semconv:opentelemetry-semconv Bumps [io.opentelemetry.semconv:opentelemetry-semconv](https://github.com/open-telemetry/semantic-conventions-java) from 1.29.0-alpha to 1.30.0-rc.1. - [Release notes](https://github.com/open-telemetry/semantic-conventions-java/releases) - [Changelog](https://github.com/open-telemetry/semantic-conventions-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/semantic-conventions-java/commits/v1.30.0-rc.1) --- updated-dependencies: - dependency-name: io.opentelemetry.semconv:opentelemetry-semconv dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * remove usage of now stale semconv attributes * remove semconv dependency * code cleanup * remove leftovers references --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com>
1 parent 9c016e0 commit d764d1f

File tree

4 files changed

+18
-63
lines changed

4 files changed

+18
-63
lines changed

apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml

-7
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@
2929
<scope>provided</scope>
3030
</dependency>
3131

32-
<dependency>
33-
<groupId>io.opentelemetry.semconv</groupId>
34-
<artifactId>opentelemetry-semconv</artifactId>
35-
<version>${version.opentelemetry-semconv}</version>
36-
<scope>test</scope>
37-
</dependency>
38-
3932
<dependency>
4033
<groupId>${project.groupId}</groupId>
4134
<artifactId>apm-opentelemetry-embedded-metrics-sdk</artifactId>

apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/SemAttributes.java

+6-21
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,14 @@
2121
import io.opentelemetry.api.common.AttributeKey;
2222

2323
/**
24-
* Bridge for integration tests which use {@link io.opentelemetry.semconv.SemanticAttributes}
24+
* Bridge for integration tests which use semconv attributes
2525
* which has been moved from {@code io.opentelemetry.semconv.trace.attributes.SemanticAttributes}.
2626
*/
2727
public class SemAttributes {
2828

29-
public static final AttributeKey<String> HTTP_URL = getAttribute("HTTP_URL");
30-
public static final AttributeKey<Long> HTTP_STATUS_CODE = getAttribute("HTTP_STATUS_CODE");
31-
public static final AttributeKey<String> HTTP_METHOD = getAttribute("HTTP_METHOD");
32-
public static final AttributeKey<Long> NET_PEER_PORT = getAttribute("NET_PEER_PORT");
33-
public static final AttributeKey<String> NET_PEER_IP = getAttribute("NET_PEER_IP");
34-
35-
@SuppressWarnings("unchecked")
36-
private static <T> AttributeKey<T> getAttribute(String name) {
37-
try {
38-
Class<?> attribClass;
39-
try {
40-
attribClass = Class.forName("io.opentelemetry.semconv.SemanticAttributes");
41-
} catch (ClassNotFoundException cnf) {
42-
attribClass = Class.forName("io.opentelemetry.semconv.trace.attributes.SemanticAttributes");
43-
}
44-
return (AttributeKey<T>) attribClass.getField(name).get(null);
45-
}catch (Exception e) {
46-
throw new IllegalStateException(e);
47-
}
48-
}
29+
public static final AttributeKey<String> HTTP_URL = AttributeKey.stringKey("HTTP_URL");
30+
public static final AttributeKey<Long> HTTP_STATUS_CODE = AttributeKey.longKey("HTTP_STATUS_CODE");
31+
public static final AttributeKey<String> HTTP_METHOD = AttributeKey.stringKey("HTTP_METHOD");
32+
public static final AttributeKey<Long> NET_PEER_PORT = AttributeKey.longKey("NET_PEER_PORT");
33+
public static final AttributeKey<String> NET_PEER_IP = AttributeKey.stringKey("NET_PEER_IP");
4934
}

apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/specs/OTelBridgeStepsDefinitions.java

+11-34
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import co.elastic.apm.agent.impl.context.ServiceTargetImpl;
2222
import co.elastic.apm.agent.impl.transaction.*;
23-
import co.elastic.apm.agent.impl.transaction.TransactionImpl;
2423
import co.elastic.apm.agent.opentelemetry.global.ElasticOpenTelemetry;
2524
import co.elastic.apm.agent.opentelemetry.tracing.ElasticOpenTelemetryTest;
2625
import co.elastic.apm.agent.opentelemetry.tracing.OTelSpan;
@@ -34,7 +33,6 @@
3433
import io.opentelemetry.api.trace.SpanKind;
3534
import io.opentelemetry.api.trace.StatusCode;
3635
import io.opentelemetry.context.Context;
37-
import io.opentelemetry.semconv.SemanticAttributes;
3836

3937
import javax.annotation.Nullable;
4038
import java.util.HashMap;
@@ -103,7 +101,7 @@ public void bridgedTransactionWithRemoteContextParent() {
103101
assertThat(traceContext.getTraceId().toString()).isEqualTo(REMOTE_PARENT_TRACE_ID);
104102
}
105103

106-
private Context getRemoteContext(){
104+
private Context getRemoteContext() {
107105
return getOtel().getPropagators()
108106
.getTextMapPropagator()
109107
.extract(Context.current(),
@@ -113,7 +111,7 @@ private Context getRemoteContext(){
113111
}
114112

115113
@Given("OTel span is created without parent")
116-
public void createOTelSpanWithoutParent(){
114+
public void createOTelSpanWithoutParent() {
117115
otelSpan = (OTelSpan) getOtel().getTracer("")
118116
.spanBuilder("otel span")
119117
.setNoParent() // redundant, but makes it explicit
@@ -156,14 +154,14 @@ public void otelSpanIsCreatedWithKind(String kind) {
156154
// the parent transaction is created by another step definition, thus we reuse the existing state
157155
TransactionImpl parentTransaction = state.getTransaction();
158156

159-
Function<String,OTelSpan> createSpanWithKind = k -> {
157+
Function<String, OTelSpan> createSpanWithKind = k -> {
160158
SpanBuilder spanBuilder = getOtel().getTracer("")
161159
.spanBuilder("span")
162160
.setSpanKind(SpanKind.valueOf(k));
163161
return (OTelSpan) spanBuilder.startSpan();
164162
};
165163

166-
if( parentTransaction != null){
164+
if (parentTransaction != null) {
167165
// creating a span as a child of existing transaction
168166
try (Scope scope = parentTransaction.activateInScope()) {
169167
this.otelSpan = createSpanWithKind.apply(kind);
@@ -205,40 +203,19 @@ public void otelSpanAttributes(io.cucumber.datatable.DataTable table) {
205203
}
206204

207205
private static AttributeKey<?> lookupKey(String name) {
206+
// only doing a simple type mapping to cover existing test cases
207+
// this is not meant to be exhaustive nor to cover up-to-date semconv definitions
208208
switch (name) {
209-
case "http.url":
210-
return SemanticAttributes.HTTP_URL;
211-
case "http.scheme":
212-
return SemanticAttributes.HTTP_SCHEME;
213-
case "http.host":
214-
return SemanticAttributes.HTTP_HOST;
215-
case "net.peer.name":
216-
return SemanticAttributes.NET_PEER_NAME;
217-
case "net.peer.ip":
218-
return SemanticAttributes.NET_PEER_IP;
219209
case "net.peer.port":
220-
return SemanticAttributes.NET_PEER_PORT;
221-
case "db.system":
222-
return SemanticAttributes.DB_SYSTEM;
223-
case "db.name":
224-
return SemanticAttributes.DB_NAME;
225-
case "messaging.system":
226-
return SemanticAttributes.MESSAGING_SYSTEM;
227-
case "messaging.url":
228-
return SemanticAttributes.MESSAGING_URL;
229-
case "messaging.destination":
230-
return SemanticAttributes.MESSAGING_DESTINATION;
231-
case "rpc.system":
232-
return SemanticAttributes.RPC_SYSTEM;
233-
case "rpc.service":
234-
return SemanticAttributes.RPC_SERVICE;
210+
return AttributeKey.longKey(name);
235211
default:
236-
throw new IllegalArgumentException("unknown key for name " + name);
212+
return AttributeKey.stringKey(name);
213+
237214
}
238215
}
239216

240217
@Then("Elastic bridged (transaction|span) OTel kind is {string}")
241-
public void bridgeObjectKind(String kind){
218+
public void bridgeObjectKind(String kind) {
242219
assertThat(getBridgedAbstractSpan().getOtelKind())
243220
.isEqualTo(OTelSpanKind.valueOf(kind));
244221
}
@@ -325,7 +302,7 @@ public void bridgedSpanTargetServiceType(String type, String name) {
325302
}
326303

327304
@Then("OTel span status set to {string}")
328-
public void setOtelSpanStatus(String status){
305+
public void setOtelSpanStatus(String status) {
329306
otelSpan.setStatus(StatusCode.valueOf(status.toUpperCase(Locale.ROOT)));
330307
}
331308

apm-agent-plugins/apm-opentelemetry/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
to make sure that in the future we stay compatible with the previous version.
2121
-->
2222
<version.opentelemetry>1.32.0</version.opentelemetry>
23-
<version.opentelemetry-semconv>1.29.0-alpha</version.opentelemetry-semconv>
23+
<version.opentelemetry-semconv>1.30.0-rc.1</version.opentelemetry-semconv>
2424

2525
<maven.compiler.target>8</maven.compiler.target>
2626
<maven.compiler.source>8</maven.compiler.source>

0 commit comments

Comments
 (0)