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

@@ -60,7 +60,6 @@ class DefaultHttpRequestsObservationConventionTests {
void addsKeyValuesForExchange() {
this.request.setMethod("POST");
this.request.setRequestURI("/test/resource");
this.request.setPathInfo("/test/resource");
assertThat(this.convention.getLowCardinalityKeyValues(this.context)).hasSize(5)
.contains(KeyValue.of("method", "POST"), KeyValue.of("uri", "UNKNOWN"), KeyValue.of("status", "200"),
@@ -72,7 +71,6 @@ class DefaultHttpRequestsObservationConventionTests {
@Test
void addsKeyValuesForExchangeWithPathPattern() {
this.request.setRequestURI("/test/resource");
this.request.setPathInfo("/test/resource");
this.context.setPathPattern("/test/{name}");
assertThat(this.convention.getLowCardinalityKeyValues(this.context)).hasSize(5)
@@ -85,7 +83,6 @@ class DefaultHttpRequestsObservationConventionTests {
@Test
void addsKeyValuesForErrorExchange() {
this.request.setRequestURI("/test/resource");
this.request.setPathInfo("/test/resource");
this.context.setError(new IllegalArgumentException("custom error"));
this.response.setStatus(500);
@@ -99,7 +96,6 @@ class DefaultHttpRequestsObservationConventionTests {
@Test
void addsKeyValuesForRedirectExchange() {
this.request.setRequestURI("/test/redirect");
this.request.setPathInfo("/test/redirect");
this.response.setStatus(302);
this.response.addHeader("Location", "https://example.org/other");
@@ -113,7 +109,6 @@ class DefaultHttpRequestsObservationConventionTests {
@Test
void addsKeyValuesForNotFoundExchange() {
this.request.setRequestURI("/test/notFound");
this.request.setPathInfo("/test/notFound");
this.response.setStatus(404);
assertThat(this.convention.getLowCardinalityKeyValues(this.context)).hasSize(5)