Update network.protocol.version 2.0 -> 2 and 3.0 -> 3 (#9145)
This commit is contained in:
parent
ecb61fbf87
commit
67f91b8833
|
@ -77,6 +77,9 @@ public final class ApacheHttpClientRequest {
|
|||
|
||||
String getProtocolVersion() {
|
||||
ProtocolVersion protocolVersion = delegate.getProtocolVersion();
|
||||
if (protocolVersion.getMinor() == 0) {
|
||||
return Integer.toString(protocolVersion.getMajor());
|
||||
}
|
||||
return protocolVersion.getMajor() + "." + protocolVersion.getMinor();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,9 @@ public final class ApacheHttpClientRequest {
|
|||
|
||||
String getProtocolVersion() {
|
||||
ProtocolVersion protocolVersion = delegate.getProtocolVersion();
|
||||
if (protocolVersion.getMinor() == 0) {
|
||||
return Integer.toString(protocolVersion.getMajor());
|
||||
}
|
||||
return protocolVersion.getMajor() + "." + protocolVersion.getMinor();
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,9 @@ final class ApacheHttpClientHttpAttributesGetter
|
|||
if (protocolVersion == null) {
|
||||
return null;
|
||||
}
|
||||
if (protocolVersion.getMinor() == 0) {
|
||||
return Integer.toString(protocolVersion.getMajor());
|
||||
}
|
||||
return protocolVersion.getMajor() + "." + protocolVersion.getMinor();
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ enum ArmeriaHttpServerAttributesGetter
|
|||
@Override
|
||||
public String getNetworkProtocolVersion(RequestContext ctx, @Nullable RequestLog requestLog) {
|
||||
SessionProtocol protocol = ctx.sessionProtocol();
|
||||
return protocol.isMultiplex() ? "2.0" : "1.1";
|
||||
return protocol.isMultiplex() ? "2" : "1.1";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -74,7 +74,7 @@ public enum ArmeriaHttpClientAttributesGetter
|
|||
@Override
|
||||
public String getNetworkProtocolVersion(RequestContext ctx, @Nullable RequestLog requestLog) {
|
||||
SessionProtocol protocol = ctx.sessionProtocol();
|
||||
return protocol.isMultiplex() ? "2.0" : "1.1";
|
||||
return protocol.isMultiplex() ? "2" : "1.1";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -61,6 +61,9 @@ final class AsyncHttpClientHttpAttributesGetter
|
|||
if (httpVersion == null) {
|
||||
return null;
|
||||
}
|
||||
if (httpVersion.minorVersion() == 0) {
|
||||
return Integer.toString(httpVersion.majorVersion());
|
||||
}
|
||||
return httpVersion.majorVersion() + "." + httpVersion.minorVersion();
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,9 @@ class AwsSdkHttpAttributesGetter implements HttpClientAttributesGetter<Request<?
|
|||
if (protocolVersion == null) {
|
||||
return null;
|
||||
}
|
||||
if (protocolVersion.getMinor() == 0) {
|
||||
return Integer.toString(protocolVersion.getMajor());
|
||||
}
|
||||
return protocolVersion.getMajor() + "." + protocolVersion.getMinor();
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public enum JavaHttpClientAttributesGetter
|
|||
case HTTP_1_1:
|
||||
return "1.1";
|
||||
case HTTP_2:
|
||||
return "2.0";
|
||||
return "2";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.instrumentation.ktor.v2_0.client
|
||||
|
||||
import io.ktor.client.request.*
|
||||
import io.ktor.client.statement.HttpResponse
|
||||
import io.ktor.client.statement.*
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesGetter
|
||||
|
||||
internal object KtorHttpClientAttributesGetter : HttpClientAttributesGetter<HttpRequestData, HttpResponse> {
|
||||
|
@ -31,6 +31,9 @@ internal object KtorHttpClientAttributesGetter : HttpClientAttributesGetter<Http
|
|||
|
||||
override fun getNetworkProtocolVersion(request: HttpRequestData?, response: HttpResponse?): String? {
|
||||
val version = response?.version ?: return null
|
||||
if (version.minor == 0) {
|
||||
return "${version.major}"
|
||||
}
|
||||
return "${version.major}.${version.minor}"
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,9 @@ final class NettyHttpClientAttributesGetter
|
|||
public String getNetworkProtocolVersion(
|
||||
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse httpResponse) {
|
||||
HttpVersion version = requestAndChannel.request().getProtocolVersion();
|
||||
if (version.getMinorVersion() == 0) {
|
||||
return Integer.toString(version.getMajorVersion());
|
||||
}
|
||||
return version.getMajorVersion() + "." + version.getMinorVersion();
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,9 @@ final class NettyHttpServerAttributesGetter
|
|||
public String getNetworkProtocolVersion(
|
||||
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) {
|
||||
HttpVersion version = requestAndChannel.request().getProtocolVersion();
|
||||
if (version.getMinorVersion() == 0) {
|
||||
return Integer.toString(version.getMajorVersion());
|
||||
}
|
||||
return version.getMajorVersion() + "." + version.getMinorVersion();
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,9 @@ final class NettyHttpClientAttributesGetter
|
|||
public String getNetworkProtocolVersion(
|
||||
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) {
|
||||
HttpVersion version = requestAndChannel.request().getProtocolVersion();
|
||||
if (version.minorVersion() == 0) {
|
||||
return Integer.toString(version.majorVersion());
|
||||
}
|
||||
return version.majorVersion() + "." + version.minorVersion();
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,9 @@ final class NettyHttpServerAttributesGetter
|
|||
public String getNetworkProtocolVersion(
|
||||
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) {
|
||||
HttpVersion version = requestAndChannel.request().getProtocolVersion();
|
||||
if (version.minorVersion() == 0) {
|
||||
return Integer.toString(version.majorVersion());
|
||||
}
|
||||
return version.majorVersion() + "." + version.minorVersion();
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ final class OkHttp2HttpAttributesGetter implements HttpClientAttributesGetter<Re
|
|||
case HTTP_1_1:
|
||||
return "1.1";
|
||||
case HTTP_2:
|
||||
return "2.0";
|
||||
return "2";
|
||||
case SPDY_3:
|
||||
return "3.1";
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public enum OkHttpAttributesGetter implements HttpClientAttributesGetter<Request
|
|||
case HTTP_1_1:
|
||||
return "1.1";
|
||||
case HTTP_2:
|
||||
return "2.0";
|
||||
return "2";
|
||||
case SPDY_3:
|
||||
return "3.1";
|
||||
}
|
||||
|
|
|
@ -63,6 +63,9 @@ final class ReactorNettyHttpClientAttributesGetter
|
|||
return null;
|
||||
}
|
||||
HttpVersion version = response.version();
|
||||
if (version.minorVersion() == 0) {
|
||||
return Integer.toString(version.majorVersion());
|
||||
}
|
||||
return version.majorVersion() + "." + version.minorVersion();
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ final class Vertx4HttpAttributesGetter extends AbstractVertxHttpAttributesGetter
|
|||
case HTTP_1_1:
|
||||
return "1.1";
|
||||
case HTTP_2:
|
||||
return "2.0";
|
||||
return "2";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue