Provide full request URL for "http.url" keyvalue

Prior to this commit, the Observation filter for Servlet applications
would only use the request pathInfo as an "http.url" high cardinality
keyvalue. This commit ensures that we're using the full request URL as a
value there.

This also polishes gh-29254.

Fixes gh-29257
See gh-29254
This commit is contained in:
Brian Clozel
2022-10-05 11:40:28 +02:00
parent 7dd6afc263
commit 681cf0dae7
5 changed files with 13 additions and 19 deletions

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.HTTP_URL, "none");
private static final KeyValue HTTP_URL_NONE = KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.HTTP_URL, "none");
private static final KeyValue CLIENT_NAME_NONE = KeyValue.of(ClientHttpObservation.HighCardinalityKeyNames.CLIENT_NAME, "none");
@@ -135,14 +135,14 @@ public class DefaultClientObservationConvention implements ClientObservationConv
@Override
public KeyValues getHighCardinalityKeyValues(ClientObservationContext context) {
return KeyValues.of(uriExpanded(context), clientName(context));
return KeyValues.of(httpUrl(context), clientName(context));
}
protected KeyValue uriExpanded(ClientObservationContext context) {
protected KeyValue httpUrl(ClientObservationContext context) {
if (context.getCarrier() != null) {
return KeyValue.of(ClientObservation.HighCardinalityKeyNames.HTTP_URL, context.getCarrier().url().toASCIIString());
}
return URI_EXPANDED_NONE;
return HTTP_URL_NONE;
}
protected KeyValue clientName(ClientObservationContext context) {