Skip to content

Commit

Permalink
Remove server.{address,port} from HTTP server metrics (#8771)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek committed Jun 28, 2023
1 parent bb4211d commit 91a5cce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ private static Set<AttributeKey> buildDurationAlwaysInclude() {
view.add(HttpAttributes.HTTP_RESPONSE_STATUS_CODE);
view.add(NetworkAttributes.NETWORK_PROTOCOL_NAME);
view.add(NetworkAttributes.NETWORK_PROTOCOL_VERSION);
view.add(NetworkAttributes.SERVER_ADDRESS);
view.add(NetworkAttributes.SERVER_PORT);
return view;
}

Expand All @@ -54,6 +52,8 @@ private static Set<AttributeKey> buildDurationClientView() {
view.add(SemanticAttributes.NET_SOCK_PEER_ADDR);
// stable semconv
view.add(NetworkAttributes.SERVER_SOCKET_ADDRESS);
view.add(NetworkAttributes.SERVER_ADDRESS);
view.add(NetworkAttributes.SERVER_PORT);
return view;
}

Expand Down Expand Up @@ -83,8 +83,6 @@ private static Set<AttributeKey> buildActiveRequestsView() {
view.add(SemanticAttributes.NET_HOST_PORT);
// stable semconv
view.add(HttpAttributes.HTTP_REQUEST_METHOD);
view.add(NetworkAttributes.SERVER_ADDRESS);
view.add(NetworkAttributes.SERVER_PORT);
view.add(UrlAttributes.URL_SCHEME);
return view;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ void shouldApplyServerDurationAndSizeView_stableSemconv() {
entry(SemanticAttributes.HTTP_ROUTE, "/somehost/high/{name}/{id}"),
entry(UrlAttributes.URL_SCHEME, "https"),
entry(NetworkAttributes.NETWORK_PROTOCOL_NAME, "http"),
entry(NetworkAttributes.NETWORK_PROTOCOL_VERSION, "1.1"),
entry(NetworkAttributes.SERVER_ADDRESS, "somehost"),
entry(NetworkAttributes.SERVER_PORT, 443L));
entry(NetworkAttributes.NETWORK_PROTOCOL_VERSION, "1.1"));
}

@Test
Expand Down Expand Up @@ -234,8 +232,6 @@ void shouldApplyActiveRequestsView_stableSemconv() {
assertThat(applyActiveRequestsView(attributes))
.containsOnly(
entry(HttpAttributes.HTTP_REQUEST_METHOD, "GET"),
entry(UrlAttributes.URL_SCHEME, "https"),
entry(NetworkAttributes.SERVER_ADDRESS, "somehost"),
entry(NetworkAttributes.SERVER_PORT, 443L));
entry(UrlAttributes.URL_SCHEME, "https"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ void collectsMetrics() {
.hasValue(1)
.hasAttributesSatisfying(
equalTo(HttpAttributes.HTTP_REQUEST_METHOD, "GET"),
equalTo(UrlAttributes.URL_SCHEME, "https"),
equalTo(NetworkAttributes.SERVER_ADDRESS, "localhost"),
equalTo(NetworkAttributes.SERVER_PORT, 1234L))
equalTo(UrlAttributes.URL_SCHEME, "https"))
.hasExemplarsSatisfying(
exemplar ->
exemplar
Expand All @@ -118,9 +116,7 @@ void collectsMetrics() {
.hasValue(2)
.hasAttributesSatisfying(
equalTo(HttpAttributes.HTTP_REQUEST_METHOD, "GET"),
equalTo(UrlAttributes.URL_SCHEME, "https"),
equalTo(NetworkAttributes.SERVER_ADDRESS, "localhost"),
equalTo(NetworkAttributes.SERVER_PORT, 1234L))
equalTo(UrlAttributes.URL_SCHEME, "https"))
.hasExemplarsSatisfying(
exemplar ->
exemplar
Expand All @@ -142,9 +138,7 @@ void collectsMetrics() {
.hasValue(1)
.hasAttributesSatisfying(
equalTo(HttpAttributes.HTTP_REQUEST_METHOD, "GET"),
equalTo(UrlAttributes.URL_SCHEME, "https"),
equalTo(NetworkAttributes.SERVER_ADDRESS, "localhost"),
equalTo(NetworkAttributes.SERVER_PORT, 1234L))
equalTo(UrlAttributes.URL_SCHEME, "https"))
.hasExemplarsSatisfying(
exemplar ->
exemplar
Expand All @@ -167,9 +161,7 @@ void collectsMetrics() {
NetworkAttributes.NETWORK_PROTOCOL_NAME, "http"),
equalTo(
NetworkAttributes.NETWORK_PROTOCOL_VERSION, "2.0"),
equalTo(UrlAttributes.URL_SCHEME, "https"),
equalTo(NetworkAttributes.SERVER_ADDRESS, "localhost"),
equalTo(NetworkAttributes.SERVER_PORT, 1234L))
equalTo(UrlAttributes.URL_SCHEME, "https"))
.hasExemplarsSatisfying(
exemplar ->
exemplar
Expand All @@ -193,9 +185,7 @@ void collectsMetrics() {
NetworkAttributes.NETWORK_PROTOCOL_NAME, "http"),
equalTo(
NetworkAttributes.NETWORK_PROTOCOL_VERSION, "2.0"),
equalTo(UrlAttributes.URL_SCHEME, "https"),
equalTo(NetworkAttributes.SERVER_ADDRESS, "localhost"),
equalTo(NetworkAttributes.SERVER_PORT, 1234L))
equalTo(UrlAttributes.URL_SCHEME, "https"))
.hasExemplarsSatisfying(
exemplar ->
exemplar
Expand All @@ -218,9 +208,7 @@ void collectsMetrics() {
NetworkAttributes.NETWORK_PROTOCOL_NAME, "http"),
equalTo(
NetworkAttributes.NETWORK_PROTOCOL_VERSION, "2.0"),
equalTo(UrlAttributes.URL_SCHEME, "https"),
equalTo(NetworkAttributes.SERVER_ADDRESS, "localhost"),
equalTo(NetworkAttributes.SERVER_PORT, 1234L))
equalTo(UrlAttributes.URL_SCHEME, "https"))
.hasExemplarsSatisfying(
exemplar ->
exemplar
Expand Down Expand Up @@ -328,7 +316,6 @@ void collectsHttpRouteFromEndAttributes() {
.hasSum(0.100 /* seconds */)
.hasAttributesSatisfying(
equalTo(UrlAttributes.URL_SCHEME, "https"),
equalTo(NetworkAttributes.SERVER_ADDRESS, "host"),
equalTo(
SemanticAttributes.HTTP_ROUTE, "/test/{id}")))));
}
Expand Down

0 comments on commit 91a5cce

Please sign in to comment.