Skip to content

Commit 46cd68f

Browse files
Merge pull request #1144 from microsoft/dependabot/gradle/components/http/okHttp/android/io.opentelemetry.semconv-opentelemetry-semconv-1.24.0-alpha
Bump io.opentelemetry.semconv:opentelemetry-semconv from 1.23.1-alpha to 1.24.0-alpha in /components/http/okHttp/android
2 parents fca2493 + a191db9 commit 46cd68f

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

components/http/okHttp/gradle/dependencies.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ dependencies {
1111
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
1212
implementation 'io.opentelemetry:opentelemetry-api:1.36.0'
1313
implementation 'io.opentelemetry:opentelemetry-context:1.36.0'
14-
implementation 'io.opentelemetry.semconv:opentelemetry-semconv:1.23.1-alpha'
14+
implementation 'io.opentelemetry.semconv:opentelemetry-semconv:1.24.0-alpha'
15+
implementation 'io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.24.0-alpha'
1516
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
1617
api 'com.squareup.okhttp3:okhttp:4.12.0'
1718

components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
import io.opentelemetry.api.trace.StatusCode;
2020
import io.opentelemetry.context.Context;
2121
import io.opentelemetry.context.Scope;
22-
import io.opentelemetry.semconv.SemanticAttributes;
22+
import io.opentelemetry.semconv.HttpAttributes;
23+
import io.opentelemetry.semconv.NetworkAttributes;
24+
import io.opentelemetry.semconv.ServerAttributes;
25+
import io.opentelemetry.semconv.UrlAttributes;
26+
import io.opentelemetry.semconv.incubating.HttpIncubatingAttributes;
2327

2428
import jakarta.annotation.Nonnull;
2529
import jakarta.annotation.Nullable;
@@ -720,17 +724,18 @@ private Response getHttpResponseMessage(
720724
final int contentLengthHeaderValueAsInt =
721725
Integer.parseInt(contentLengthHeaderValue);
722726
spanForAttributes.setAttribute(
723-
SemanticAttributes.HTTP_RESPONSE_BODY_SIZE, contentLengthHeaderValueAsInt);
727+
HttpIncubatingAttributes.HTTP_RESPONSE_BODY_SIZE,
728+
contentLengthHeaderValueAsInt);
724729
}
725730
final String contentTypeHeaderValue = getHeaderValue(response, "Content-Length");
726731
if (contentTypeHeaderValue != null && !contentTypeHeaderValue.isEmpty()) {
727732
spanForAttributes.setAttribute(
728733
"http.response_content_type", contentTypeHeaderValue);
729734
}
730735
spanForAttributes.setAttribute(
731-
SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, response.code());
736+
HttpAttributes.HTTP_RESPONSE_STATUS_CODE, response.code());
732737
spanForAttributes.setAttribute(
733-
SemanticAttributes.NETWORK_PROTOCOL_VERSION,
738+
NetworkAttributes.NETWORK_PROTOCOL_VERSION,
734739
response.protocol().toString().toUpperCase(Locale.ROOT));
735740
return this.retryCAEResponseIfRequired(
736741
response, requestInfo, span, spanForAttributes, claims);
@@ -786,7 +791,7 @@ private Response retryCAEResponseIfRequired(
786791
}
787792
closeResponse(true, response);
788793
span.addEvent(authenticateChallengedEventKey);
789-
spanForAttributes.setAttribute(SemanticAttributes.HTTP_RESEND_COUNT, 1);
794+
spanForAttributes.setAttribute(HttpAttributes.HTTP_REQUEST_RESEND_COUNT, 1);
790795
return this.getHttpResponseMessage(
791796
requestInfo, span, spanForAttributes, responseClaims);
792797
}
@@ -871,14 +876,14 @@ private void setBaseUrlForRequestInformation(@Nonnull final RequestInformation r
871876
.startSpan();
872877
try (final Scope scope = span.makeCurrent()) {
873878
spanForAttributes.setAttribute(
874-
SemanticAttributes.HTTP_REQUEST_METHOD, requestInfo.httpMethod.toString());
879+
HttpAttributes.HTTP_REQUEST_METHOD, requestInfo.httpMethod.toString());
875880
final URL requestURL = requestInfo.getUri().toURL();
876881
if (obsOptions.getIncludeEUIIAttributes()) {
877-
spanForAttributes.setAttribute(SemanticAttributes.URL_FULL, requestURL.toString());
882+
spanForAttributes.setAttribute(UrlAttributes.URL_FULL, requestURL.toString());
878883
}
879884
spanForAttributes.setAttribute("http.port", requestURL.getPort());
880-
spanForAttributes.setAttribute(SemanticAttributes.SERVER_ADDRESS, requestURL.getHost());
881-
spanForAttributes.setAttribute(SemanticAttributes.URL_SCHEME, requestURL.getProtocol());
885+
spanForAttributes.setAttribute(ServerAttributes.SERVER_ADDRESS, requestURL.getHost());
886+
spanForAttributes.setAttribute(UrlAttributes.URL_SCHEME, requestURL.getProtocol());
882887

883888
RequestBody body =
884889
requestInfo.content == null
@@ -922,7 +927,8 @@ public long contentLength() throws IOException {
922927
}
923928
if (length > 0) {
924929
spanForAttributes.setAttribute(
925-
SemanticAttributes.HTTP_REQUEST_BODY_SIZE, length);
930+
HttpIncubatingAttributes.HTTP_REQUEST_BODY_SIZE,
931+
length);
926932
}
927933
return length;
928934
}

0 commit comments

Comments
 (0)