|
19 | 19 | import io.opentelemetry.api.trace.StatusCode; |
20 | 20 | import io.opentelemetry.context.Context; |
21 | 21 | 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; |
23 | 27 |
|
24 | 28 | import jakarta.annotation.Nonnull; |
25 | 29 | import jakarta.annotation.Nullable; |
@@ -720,17 +724,18 @@ private Response getHttpResponseMessage( |
720 | 724 | final int contentLengthHeaderValueAsInt = |
721 | 725 | Integer.parseInt(contentLengthHeaderValue); |
722 | 726 | spanForAttributes.setAttribute( |
723 | | - SemanticAttributes.HTTP_RESPONSE_BODY_SIZE, contentLengthHeaderValueAsInt); |
| 727 | + HttpIncubatingAttributes.HTTP_RESPONSE_BODY_SIZE, |
| 728 | + contentLengthHeaderValueAsInt); |
724 | 729 | } |
725 | 730 | final String contentTypeHeaderValue = getHeaderValue(response, "Content-Length"); |
726 | 731 | if (contentTypeHeaderValue != null && !contentTypeHeaderValue.isEmpty()) { |
727 | 732 | spanForAttributes.setAttribute( |
728 | 733 | "http.response_content_type", contentTypeHeaderValue); |
729 | 734 | } |
730 | 735 | spanForAttributes.setAttribute( |
731 | | - SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, response.code()); |
| 736 | + HttpAttributes.HTTP_RESPONSE_STATUS_CODE, response.code()); |
732 | 737 | spanForAttributes.setAttribute( |
733 | | - SemanticAttributes.NETWORK_PROTOCOL_VERSION, |
| 738 | + NetworkAttributes.NETWORK_PROTOCOL_VERSION, |
734 | 739 | response.protocol().toString().toUpperCase(Locale.ROOT)); |
735 | 740 | return this.retryCAEResponseIfRequired( |
736 | 741 | response, requestInfo, span, spanForAttributes, claims); |
@@ -786,7 +791,7 @@ private Response retryCAEResponseIfRequired( |
786 | 791 | } |
787 | 792 | closeResponse(true, response); |
788 | 793 | span.addEvent(authenticateChallengedEventKey); |
789 | | - spanForAttributes.setAttribute(SemanticAttributes.HTTP_RESEND_COUNT, 1); |
| 794 | + spanForAttributes.setAttribute(HttpAttributes.HTTP_REQUEST_RESEND_COUNT, 1); |
790 | 795 | return this.getHttpResponseMessage( |
791 | 796 | requestInfo, span, spanForAttributes, responseClaims); |
792 | 797 | } |
@@ -871,14 +876,14 @@ private void setBaseUrlForRequestInformation(@Nonnull final RequestInformation r |
871 | 876 | .startSpan(); |
872 | 877 | try (final Scope scope = span.makeCurrent()) { |
873 | 878 | spanForAttributes.setAttribute( |
874 | | - SemanticAttributes.HTTP_REQUEST_METHOD, requestInfo.httpMethod.toString()); |
| 879 | + HttpAttributes.HTTP_REQUEST_METHOD, requestInfo.httpMethod.toString()); |
875 | 880 | final URL requestURL = requestInfo.getUri().toURL(); |
876 | 881 | if (obsOptions.getIncludeEUIIAttributes()) { |
877 | | - spanForAttributes.setAttribute(SemanticAttributes.URL_FULL, requestURL.toString()); |
| 882 | + spanForAttributes.setAttribute(UrlAttributes.URL_FULL, requestURL.toString()); |
878 | 883 | } |
879 | 884 | 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()); |
882 | 887 |
|
883 | 888 | RequestBody body = |
884 | 889 | requestInfo.content == null |
@@ -922,7 +927,8 @@ public long contentLength() throws IOException { |
922 | 927 | } |
923 | 928 | if (length > 0) { |
924 | 929 | spanForAttributes.setAttribute( |
925 | | - SemanticAttributes.HTTP_REQUEST_BODY_SIZE, length); |
| 930 | + HttpIncubatingAttributes.HTTP_REQUEST_BODY_SIZE, |
| 931 | + length); |
926 | 932 | } |
927 | 933 | return length; |
928 | 934 | } |
|
0 commit comments