Change keyvalue name to http.url in server observations

This commit changes the new high cardinality key value from
"uri.expanded" to "http.url" in order to align with the OTel
specification, since there is no need for backwards compatibility on
this new metadata.

Closes gh-29254
This commit is contained in:
Brian Clozel 2022-10-05 09:55:42 +02:00
parent 2f20d6322b
commit 486a1b6024
12 changed files with 33 additions and 33 deletions

View File

@ -115,10 +115,10 @@ public enum ClientHttpObservation implements DocumentedObservation {
/**
* HTTP request URI.
*/
URI_EXPANDED {
HTTP_URL {
@Override
public String asString() {
return "uri.expanded";
return "http.url";
}
},

View File

@ -46,7 +46,7 @@ public class DefaultClientHttpObservationConvention implements ClientHttpObserva
private static final KeyValue EXCEPTION_NONE = KeyValue.of(ClientHttpObservation.LowCardinalityKeyNames.EXCEPTION, "none");
private static final KeyValue URI_EXPANDED_NONE = KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.URI_EXPANDED, "none");
private static final KeyValue URI_EXPANDED_NONE = KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.HTTP_URL, "none");
private static final KeyValue CLIENT_NAME_NONE = KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.CLIENT_NAME, "none");
@ -139,7 +139,7 @@ public class DefaultClientHttpObservationConvention implements ClientHttpObserva
protected KeyValue requestUri(ClientHttpObservationContext context) {
if (context.getCarrier() != null) {
return KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.URI_EXPANDED, context.getCarrier().getURI().toASCIIString());
return KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.HTTP_URL, context.getCarrier().getURI().toASCIIString());
}
return URI_EXPANDED_NONE;
}

View File

@ -47,7 +47,7 @@ public class DefaultHttpRequestsObservationConvention implements HttpRequestsObs
private static final KeyValue EXCEPTION_NONE = KeyValue.of(HttpRequestsObservation.LowCardinalityKeyNames.EXCEPTION, "none");
private static final KeyValue URI_EXPANDED_UNKNOWN = KeyValue.of(HttpRequestsObservation.HighCardinalityKeyNames.URI_EXPANDED, "UNKNOWN");
private static final KeyValue URI_EXPANDED_UNKNOWN = KeyValue.of(HttpRequestsObservation.HighCardinalityKeyNames.HTTP_URL, "UNKNOWN");
private final String name;
@ -139,7 +139,7 @@ public class DefaultHttpRequestsObservationConvention implements HttpRequestsObs
protected KeyValue uriExpanded(HttpRequestsObservationContext context) {
if (context.getCarrier() != null) {
String uriExpanded = (context.getCarrier().getPathInfo() != null) ? context.getCarrier().getPathInfo() : "/";
return KeyValue.of(HttpRequestsObservation.HighCardinalityKeyNames.URI_EXPANDED, uriExpanded);
return KeyValue.of(HttpRequestsObservation.HighCardinalityKeyNames.HTTP_URL, uriExpanded);
}
return URI_EXPANDED_UNKNOWN;
}

View File

@ -113,10 +113,10 @@ public enum HttpRequestsObservation implements DocumentedObservation {
/**
* HTTP request URI.
*/
URI_EXPANDED {
HTTP_URL {
@Override
public String asString() {
return "uri.expanded";
return "http.url";
}
}

View File

@ -48,7 +48,7 @@ public class DefaultHttpRequestsObservationConvention implements HttpRequestsObs
private static final KeyValue EXCEPTION_NONE = KeyValue.of(HttpRequestsObservation.LowCardinalityKeyNames.EXCEPTION, "none");
private static final KeyValue URI_EXPANDED_UNKNOWN = KeyValue.of(HttpRequestsObservation.HighCardinalityKeyNames.URI_EXPANDED, "UNKNOWN");
private static final KeyValue URI_EXPANDED_UNKNOWN = KeyValue.of(HttpRequestsObservation.HighCardinalityKeyNames.HTTP_URL, "UNKNOWN");
private final String name;
@ -146,7 +146,7 @@ public class DefaultHttpRequestsObservationConvention implements HttpRequestsObs
protected KeyValue uriExpanded(HttpRequestsObservationContext context) {
if (context.getCarrier() != null) {
String uriExpanded = context.getCarrier().getPath().toString();
return KeyValue.of(HttpRequestsObservation.HighCardinalityKeyNames.URI_EXPANDED, uriExpanded);
return KeyValue.of(HttpRequestsObservation.HighCardinalityKeyNames.HTTP_URL, uriExpanded);
}
return URI_EXPANDED_UNKNOWN;
}

View File

@ -113,10 +113,10 @@ public enum HttpRequestsObservation implements DocumentedObservation {
/**
* HTTP request URI.
*/
URI_EXPANDED {
HTTP_URL {
@Override
public String asString() {
return "uri.expanded";
return "http.url";
}
}

View File

@ -71,7 +71,7 @@ class DefaultClientHttpObservationConventionTests {
.contains(KeyValue.of("exception", "none"), KeyValue.of("method", "GET"), KeyValue.of("uri", "/resource/{id}"),
KeyValue.of("status", "200"), KeyValue.of("outcome", "SUCCESS"));
assertThat(this.observationConvention.getHighCardinalityKeyValues(context)).hasSize(2)
.contains(KeyValue.of("client.name", "none"), KeyValue.of("uri.expanded", "/resource/42"));
.contains(KeyValue.of("client.name", "none"), KeyValue.of("http.url", "/resource/42"));
}
@Test
@ -81,7 +81,7 @@ class DefaultClientHttpObservationConventionTests {
assertThat(this.observationConvention.getLowCardinalityKeyValues(context))
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "none"));
assertThat(this.observationConvention.getHighCardinalityKeyValues(context)).hasSize(2)
.contains(KeyValue.of("uri.expanded", "/resource/42"));
.contains(KeyValue.of("http.url", "/resource/42"));
}
@Test

View File

@ -66,7 +66,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "POST"), KeyValue.of("uri", "UNKNOWN"), KeyValue.of("status", "200"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "SUCCESS"));
assertThat(this.convention.getHighCardinalityKeyValues(this.context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/resource"));
.contains(KeyValue.of("http.url", "/test/resource"));
}
@Test
@ -79,7 +79,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "/test/{name}"), KeyValue.of("status", "200"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "SUCCESS"));
assertThat(this.convention.getHighCardinalityKeyValues(this.context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/resource"));
.contains(KeyValue.of("http.url", "/test/resource"));
}
@Test
@ -93,7 +93,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "UNKNOWN"), KeyValue.of("status", "500"),
KeyValue.of("exception", "IllegalArgumentException"), KeyValue.of("outcome", "SERVER_ERROR"));
assertThat(this.convention.getHighCardinalityKeyValues(this.context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/resource"));
.contains(KeyValue.of("http.url", "/test/resource"));
}
@Test
@ -107,7 +107,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "REDIRECTION"), KeyValue.of("status", "302"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "REDIRECTION"));
assertThat(this.convention.getHighCardinalityKeyValues(this.context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/redirect"));
.contains(KeyValue.of("http.url", "/test/redirect"));
}
@Test
@ -120,7 +120,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "NOT_FOUND"), KeyValue.of("status", "404"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "CLIENT_ERROR"));
assertThat(this.convention.getHighCardinalityKeyValues(this.context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/notFound"));
.contains(KeyValue.of("http.url", "/test/notFound"));
}
}

View File

@ -67,7 +67,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "POST"), KeyValue.of("uri", "UNKNOWN"), KeyValue.of("status", "201"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "SUCCESS"));
assertThat(this.convention.getHighCardinalityKeyValues(context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/resource"));
.contains(KeyValue.of("http.url", "/test/resource"));
}
@Test
@ -82,7 +82,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "/test/{name}"), KeyValue.of("status", "200"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "SUCCESS"));
assertThat(this.convention.getHighCardinalityKeyValues(context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/resource"));
.contains(KeyValue.of("http.url", "/test/resource"));
}
@ -97,7 +97,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "UNKNOWN"), KeyValue.of("status", "500"),
KeyValue.of("exception", "IllegalArgumentException"), KeyValue.of("outcome", "SERVER_ERROR"));
assertThat(this.convention.getHighCardinalityKeyValues(context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/resource"));
.contains(KeyValue.of("http.url", "/test/resource"));
}
@Test
@ -111,7 +111,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "REDIRECTION"), KeyValue.of("status", "302"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "REDIRECTION"));
assertThat(this.convention.getHighCardinalityKeyValues(context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/redirect"));
.contains(KeyValue.of("http.url", "/test/redirect"));
}
@Test
@ -124,7 +124,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "NOT_FOUND"), KeyValue.of("status", "404"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "CLIENT_ERROR"));
assertThat(this.convention.getHighCardinalityKeyValues(context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/notFound"));
.contains(KeyValue.of("http.url", "/test/notFound"));
}
@Test
@ -138,7 +138,7 @@ class DefaultHttpRequestsObservationConventionTests {
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "UNKNOWN"), KeyValue.of("status", "UNKNOWN"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "UNKNOWN"));
assertThat(this.convention.getHighCardinalityKeyValues(context)).hasSize(1)
.contains(KeyValue.of("uri.expanded", "/test/resource"));
.contains(KeyValue.of("http.url", "/test/resource"));
}
private static PathPattern getPathPattern(String pattern) {

View File

@ -113,10 +113,10 @@ public enum ClientObservation implements DocumentedObservation {
/**
* HTTP request URI.
*/
URI_EXPANDED {
HTTP_URL {
@Override
public String asString() {
return "uri.expanded";
return "http.url";
}
},

View File

@ -47,7 +47,7 @@ public class DefaultClientObservationConvention implements ClientObservationConv
private static final KeyValue EXCEPTION_NONE = KeyValue.of(ClientObservation.LowCardinalityKeyNames.EXCEPTION, "none");
private static final KeyValue URI_EXPANDED_NONE = KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.URI_EXPANDED, "none");
private static final KeyValue URI_EXPANDED_NONE = KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.HTTP_URL, "none");
private static final KeyValue CLIENT_NAME_NONE = KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.CLIENT_NAME, "none");
@ -140,7 +140,7 @@ public class DefaultClientObservationConvention implements ClientObservationConv
protected KeyValue uriExpanded(ClientObservationContext context) {
if (context.getCarrier() != null) {
return KeyValue.of(ClientObservation.HighCardinalityKeyNames.URI_EXPANDED, context.getCarrier().url().toASCIIString());
return KeyValue.of(ClientObservation.HighCardinalityKeyNames.HTTP_URL, context.getCarrier().url().toASCIIString());
}
return URI_EXPANDED_NONE;
}

View File

@ -61,7 +61,7 @@ class DefaultClientObservationConventionTests {
.contains(KeyValue.of("method", "none"), KeyValue.of("uri", "none"), KeyValue.of("status", "CLIENT_ERROR"),
KeyValue.of("exception", "none"), KeyValue.of("outcome", "UNKNOWN"));
assertThat(this.observationConvention.getHighCardinalityKeyValues(context)).hasSize(2)
.contains(KeyValue.of("client.name", "none"), KeyValue.of("uri.expanded", "none"));
.contains(KeyValue.of("client.name", "none"), KeyValue.of("http.url", "none"));
}
@Test
@ -72,7 +72,7 @@ class DefaultClientObservationConventionTests {
.contains(KeyValue.of("method", "none"), KeyValue.of("uri", "none"), KeyValue.of("status", "CLIENT_ERROR"),
KeyValue.of("exception", "IllegalStateException"), KeyValue.of("outcome", "UNKNOWN"));
assertThat(this.observationConvention.getHighCardinalityKeyValues(context)).hasSize(2)
.contains(KeyValue.of("client.name", "none"), KeyValue.of("uri.expanded", "none"));
.contains(KeyValue.of("client.name", "none"), KeyValue.of("http.url", "none"));
}
@Test
@ -85,7 +85,7 @@ class DefaultClientObservationConventionTests {
.contains(KeyValue.of("exception", "none"), KeyValue.of("method", "GET"), KeyValue.of("uri", "/resource/{id}"),
KeyValue.of("status", "200"), KeyValue.of("outcome", "SUCCESS"));
assertThat(this.observationConvention.getHighCardinalityKeyValues(context)).hasSize(2)
.contains(KeyValue.of("client.name", "none"), KeyValue.of("uri.expanded", "/resource/42"));
.contains(KeyValue.of("client.name", "none"), KeyValue.of("http.url", "/resource/42"));
}
@Test
@ -93,7 +93,7 @@ class DefaultClientObservationConventionTests {
ClientObservationContext context = createContext(ClientRequest.create(HttpMethod.GET, URI.create("/resource/42")).build());
assertThat(this.observationConvention.getLowCardinalityKeyValues(context))
.contains(KeyValue.of("method", "GET"), KeyValue.of("uri", "none"));
assertThat(this.observationConvention.getHighCardinalityKeyValues(context)).hasSize(2).contains(KeyValue.of("uri.expanded", "/resource/42"));
assertThat(this.observationConvention.getHighCardinalityKeyValues(context)).hasSize(2).contains(KeyValue.of("http.url", "/resource/42"));
}
@Test