Skip to content

Commit

Permalink
Bump io.opentelemetry.semconv:opentelemetry-semconv
Browse files Browse the repository at this point in the history
Bumps [io.opentelemetry.semconv:opentelemetry-semconv](https://github.com/open-telemetry/semantic-conventions-java) from 1.23.1-alpha to 1.24.0-alpha.
- [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)

---
updated-dependencies:
- dependency-name: io.opentelemetry.semconv:opentelemetry-semconv
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
  • Loading branch information
dependabot[bot] authored and reta committed Mar 29, 2024
1 parent 9e67851 commit 0fc7a7d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 18 deletions.
4 changes: 4 additions & 0 deletions integration/tracing/tracing-opentelemetry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
<groupId>io.opentelemetry.semconv</groupId>
<artifactId>opentelemetry-semconv</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry.semconv</groupId>
<artifactId>opentelemetry-semconv-incubating</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
import io.opentelemetry.api.trace.Tracer;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.HttpAttributes;
import io.opentelemetry.semconv.UrlAttributes;
import io.opentelemetry.semconv.incubating.ExceptionIncubatingAttributes;

public abstract class AbstractOpenTelemetryClientProvider extends AbstractTracingProvider {
protected static final Logger LOG = LogUtils.getL7dLogger(AbstractOpenTelemetryClientProvider.class);
Expand All @@ -59,8 +61,8 @@ protected TraceScopeHolder<TraceScope> startTraceSpan(final Map<String, List<Str
Context parentContext = Context.current();
Span activeSpan = tracer.spanBuilder(buildSpanDescription(uri.toString(), method))
.setParent(parentContext).setSpanKind(SpanKind.CLIENT)
.setAttribute(SemanticAttributes.HTTP_REQUEST_METHOD, method)
.setAttribute(SemanticAttributes.URL_FULL, uri.toString())
.setAttribute(HttpAttributes.HTTP_REQUEST_METHOD, method)
.setAttribute(UrlAttributes.URL_FULL, uri.toString())
// TODO: Enhance with semantics from request
.startSpan();
Scope scope = activeSpan.makeCurrent();
Expand Down Expand Up @@ -100,7 +102,7 @@ protected void stopTraceSpan(final TraceScopeHolder<TraceScope> holder, final in
scope = span.makeCurrent();
}

span.setAttribute(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE.getKey(), responseStatus);
span.setAttribute(HttpAttributes.HTTP_RESPONSE_STATUS_CODE.getKey(), responseStatus);

span.end();

Expand All @@ -126,7 +128,7 @@ protected void stopTraceSpan(final TraceScopeHolder<TraceScope> holder, final Th

span.setStatus(StatusCode.ERROR);
if (ex != null) {
span.recordException(ex, Attributes.of(SemanticAttributes.EXCEPTION_ESCAPED, true));
span.recordException(ex, Attributes.of(ExceptionIncubatingAttributes.EXCEPTION_ESCAPED, true));
}
span.end();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
import io.opentelemetry.api.trace.Tracer;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.HttpAttributes;
import io.opentelemetry.semconv.UrlAttributes;

public abstract class AbstractOpenTelemetryProvider extends AbstractTracingProvider {
protected static final Logger LOG = LogUtils.getL7dLogger(AbstractOpenTelemetryProvider.class);
Expand Down Expand Up @@ -63,8 +64,8 @@ protected TraceScopeHolder<TraceScope> startTraceSpan(final Map<String, List<Str

SpanBuilder spanBuilder = tracer.spanBuilder(buildSpanDescription(uri.getPath(), method))
.setSpanKind(SpanKind.SERVER)
.setAttribute(SemanticAttributes.HTTP_REQUEST_METHOD, method)
.setAttribute(SemanticAttributes.URL_FULL, uri.toString());
.setAttribute(HttpAttributes.HTTP_REQUEST_METHOD, method)
.setAttribute(UrlAttributes.URL_FULL, uri.toString());
Span activeSpan = spanBuilder.startSpan();
Scope scope = activeSpan.makeCurrent();

Expand Down Expand Up @@ -104,7 +105,7 @@ protected void stopTraceSpan(final Map<String, List<String>> requestHeaders,
scope = span.makeCurrent();
}

span.setAttribute(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, responseStatus);
span.setAttribute(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, responseStatus);
span.end();

scope.close();
Expand Down
7 changes: 6 additions & 1 deletion parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
<cxf.olingo.version>2.0.12</cxf.olingo.version>
<cxf.openjpa.version>3.2.2</cxf.openjpa.version>
<cxf.opentelemetry.version>1.34.1</cxf.opentelemetry.version>
<cxf.opentelemetry.semconv.version>1.23.1-alpha</cxf.opentelemetry.semconv.version>
<cxf.opentelemetry.semconv.version>1.24.0-alpha</cxf.opentelemetry.semconv.version>
<cxf.opentracing.version>0.33.0</cxf.opentracing.version>
<cxf.openwebbeans.version>2.0.27</cxf.openwebbeans.version>
<cxf.persistence-api.version>3.0.0</cxf.persistence-api.version>
Expand Down Expand Up @@ -1928,6 +1928,11 @@
<artifactId>opentelemetry-semconv</artifactId>
<version>${cxf.opentelemetry.semconv.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry.semconv</groupId>
<artifactId>opentelemetry-semconv-incubating</artifactId>
<version>${cxf.opentelemetry.semconv.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-opentracing-shim</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
import io.opentelemetry.context.Scope;
import io.opentelemetry.context.propagation.TextMapSetter;
import io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.HttpAttributes;

import org.junit.After;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -125,7 +125,7 @@ public void testThatNewSpanIsCreatedWhenNotProvided() {
assertThat(otelRule.getSpans().get(0).getName(), equalTo("Get Books"));
assertThat(otelRule.getSpans().get(1).getName(), equalTo("GET /bookstore/books"));
assertThat(otelRule.getSpans().get(1).getAttributes(),
hasAttribute(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, 200L));
hasAttribute(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 200L));
assertThat(otelRule.getSpans().get(1).getInstrumentationScopeInfo().getName(),
equalTo("jaxrs-server-test"));
}
Expand Down Expand Up @@ -397,7 +397,7 @@ public void testThatErrorSpanIsCreatedOnExceptionWhenNotProvided() {
assertThat(otelRule.getSpans().toString(), otelRule.getSpans().size(), equalTo(1));
assertThat(otelRule.getSpans().get(0).getName(), equalTo("GET /bookstore/books/exception"));
assertThat(otelRule.getSpans().get(0).getAttributes(),
hasAttribute(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, 500L));
hasAttribute(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 500L));
}

@Test
Expand All @@ -408,7 +408,7 @@ public void testThatErrorSpanIsCreatedOnErrorWhenNotProvided() {
assertThat(otelRule.getSpans().toString(), otelRule.getSpans().size(), equalTo(1));
assertThat(otelRule.getSpans().get(0).getName(), equalTo("GET /bookstore/books/error"));
assertThat(otelRule.getSpans().get(0).getAttributes(),
hasAttribute(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, 503L));
hasAttribute(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 503L));
}

@Test
Expand All @@ -419,7 +419,7 @@ public void testThatErrorSpanIsCreatedOnMappedExceptionWhenNotProvided() {
assertThat(otelRule.getSpans().toString(), otelRule.getSpans().size(), equalTo(1));
assertThat(otelRule.getSpans().get(0).getName(), equalTo("GET /bookstore/books/mapper"));
assertThat(otelRule.getSpans().get(0).getAttributes(),
hasAttribute(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, 404L));
hasAttribute(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 404L));
}

private WebClient withTrace(final WebClient client) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.HttpAttributes;

import org.junit.After;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -237,7 +237,7 @@ public void testThatNewChildSpanIsCreatedWhenParentIsProvidedInCaseOfFault() thr
assertThat(otelRule.getSpans().size(), equalTo(2));
assertThat(otelRule.getSpans().get(0).getName(), equalTo("POST /BookStore"));
assertThat(otelRule.getSpans().get(0).getAttributes(),
hasAttribute(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, 500L));
hasAttribute(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 500L));
assertThat(otelRule.getSpans().get(1).getName(),
equalTo("POST http://localhost:" + PORT + "/BookStore"));
}
Expand All @@ -252,7 +252,7 @@ public void testThatNewChildSpanIsCreatedWhenParentIsProvidedAndCustomStatusCode
assertThat(otelRule.getSpans().size(), equalTo(1));
assertThat(otelRule.getSpans().get(0).getName(), equalTo("POST /BookStore"));
assertThat(otelRule.getSpans().get(0).getAttributes(),
hasAttribute(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, 202L));
hasAttribute(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 202L));
}

@Test
Expand Down

0 comments on commit 0fc7a7d

Please sign in to comment.