Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye authored and shakuzen committed Feb 5, 2024
1 parent b8d3009 commit eda8b11
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ void recordSuccessfulExchanges(@WiremockResolver.Wiremock WireMockServer server)
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "SUCCESS")
.hasLowCardinalityKeyValue(STATUS.asString(), "200")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("SUCCESS"))
.hasLowCardinalityKeyValue(STATUS.withValue("200"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
// end::example_classic[]
}

Expand All @@ -96,9 +96,9 @@ void recordClientErrorExchanges(@WiremockResolver.Wiremock WireMockServer server
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "CLIENT_ERROR")
.hasLowCardinalityKeyValue(STATUS.asString(), "404")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("CLIENT_ERROR"))
.hasLowCardinalityKeyValue(STATUS.withValue("404"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
}

@Test
Expand All @@ -109,7 +109,7 @@ void recordUnknownUriPatternByDefault(@WiremockResolver.Wiremock WireMockServer
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(URI.asString(), "UNKNOWN");
.hasLowCardinalityKeyValue(URI.withValue("UNKNOWN"));
}

@Test
Expand All @@ -123,7 +123,7 @@ void recordUriPatternWhenHeader(@WiremockResolver.Wiremock WireMockServer server
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(URI.asString(), "/some/{name}");
.hasLowCardinalityKeyValue(URI.withValue("/some/{name}"));
}

@Test
Expand All @@ -137,7 +137,7 @@ void recordUriPatternWhenContext(@WiremockResolver.Wiremock WireMockServer serve
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(URI.asString(), "/some/{name}");
.hasLowCardinalityKeyValue(URI.withValue("/some/{name}"));
}

@ParameterizedTest
Expand All @@ -152,7 +152,7 @@ void contextualNameContainsMethod(String methodName, @WiremockResolver.Wiremock
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasContextualNameEqualTo("HTTP " + methodName)
.hasLowCardinalityKeyValue(METHOD.asString(), methodName);
.hasLowCardinalityKeyValue(METHOD.withValue(methodName));
}

@Test
Expand All @@ -164,10 +164,10 @@ void recordProtocolErrorsAsIoErrors(@WiremockResolver.Wiremock WireMockServer se
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "UNKNOWN")
.hasLowCardinalityKeyValue(STATUS.asString(), "IO_ERROR")
.hasLowCardinalityKeyValue(EXCEPTION.asString(), "ProtocolException")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("UNKNOWN"))
.hasLowCardinalityKeyValue(STATUS.withValue("IO_ERROR"))
.hasLowCardinalityKeyValue(EXCEPTION.withValue("ProtocolException"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
}

@Test
Expand All @@ -179,10 +179,10 @@ void recordSocketTimeoutAsIoErrors(@WiremockResolver.Wiremock WireMockServer ser
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "UNKNOWN")
.hasLowCardinalityKeyValue(STATUS.asString(), "IO_ERROR")
.hasLowCardinalityKeyValue(EXCEPTION.asString(), "SocketTimeoutException")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("UNKNOWN"))
.hasLowCardinalityKeyValue(STATUS.withValue("IO_ERROR"))
.hasLowCardinalityKeyValue(EXCEPTION.withValue("SocketTimeoutException"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
}

@Test
Expand All @@ -193,9 +193,9 @@ void recordRequestRetries(@WiremockResolver.Wiremock WireMockServer server) thro
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "SERVER_ERROR")
.hasLowCardinalityKeyValue(STATUS.asString(), "503")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("SERVER_ERROR"))
.hasLowCardinalityKeyValue(STATUS.withValue("503"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
assertThat(observationRegistry).hasNumberOfObservationsWithNameEqualTo(DEFAULT_METER_NAME, 2);
}

Expand Down Expand Up @@ -232,9 +232,9 @@ void recordSuccessfulExchanges(@WiremockResolver.Wiremock WireMockServer server)
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "SUCCESS")
.hasLowCardinalityKeyValue(STATUS.asString(), "200")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("SUCCESS"))
.hasLowCardinalityKeyValue(STATUS.withValue("200"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
// end::example_async[]
}

Expand All @@ -247,9 +247,9 @@ void recordClientErrorExchanges(@WiremockResolver.Wiremock WireMockServer server
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "CLIENT_ERROR")
.hasLowCardinalityKeyValue(STATUS.asString(), "404")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("CLIENT_ERROR"))
.hasLowCardinalityKeyValue(STATUS.withValue("404"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
}

@Test
Expand All @@ -261,7 +261,7 @@ void recordUnknownUriPatternByDefault(@WiremockResolver.Wiremock WireMockServer
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(URI.asString(), "UNKNOWN");
.hasLowCardinalityKeyValue(URI.withValue("UNKNOWN"));
}

@Test
Expand All @@ -276,7 +276,7 @@ void recordUriPatternWhenHeader(@WiremockResolver.Wiremock WireMockServer server
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(URI.asString(), "/some/{name}");
.hasLowCardinalityKeyValue(URI.withValue("/some/{name}"));
}

@Test
Expand All @@ -290,7 +290,7 @@ void recordUriPatternWhenContext(@WiremockResolver.Wiremock WireMockServer serve
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(URI.asString(), "/some/{name}");
.hasLowCardinalityKeyValue(URI.withValue("/some/{name}"));
}

@ParameterizedTest
Expand All @@ -306,7 +306,7 @@ void contextualNameContainsMethod(String methodName, @WiremockResolver.Wiremock
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasContextualNameEqualTo("HTTP " + methodName)
.hasLowCardinalityKeyValue(METHOD.asString(), methodName);
.hasLowCardinalityKeyValue(METHOD.withValue(methodName));
}

@Test
Expand All @@ -318,10 +318,10 @@ void recordProtocolErrorsAsIoErrors(@WiremockResolver.Wiremock WireMockServer se
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "UNKNOWN")
.hasLowCardinalityKeyValue(STATUS.asString(), "IO_ERROR")
.hasLowCardinalityKeyValue(EXCEPTION.asString(), "ProtocolException")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("UNKNOWN"))
.hasLowCardinalityKeyValue(STATUS.withValue("IO_ERROR"))
.hasLowCardinalityKeyValue(EXCEPTION.withValue("ProtocolException"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
}

@Test
Expand All @@ -334,10 +334,10 @@ void recordSocketTimeoutAsIoErrors(@WiremockResolver.Wiremock WireMockServer ser
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "UNKNOWN")
.hasLowCardinalityKeyValue(STATUS.asString(), "IO_ERROR")
.hasLowCardinalityKeyValue(EXCEPTION.asString(), "SocketTimeoutException")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("UNKNOWN"))
.hasLowCardinalityKeyValue(STATUS.withValue("IO_ERROR"))
.hasLowCardinalityKeyValue(EXCEPTION.withValue("SocketTimeoutException"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
}

@Test
Expand All @@ -349,9 +349,9 @@ void recordRequestRetries(@WiremockResolver.Wiremock WireMockServer server) thro
}
assertThat(observationRegistry).hasObservationWithNameEqualTo(DEFAULT_METER_NAME)
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "SERVER_ERROR")
.hasLowCardinalityKeyValue(STATUS.asString(), "503")
.hasLowCardinalityKeyValue(METHOD.asString(), "GET");
.hasLowCardinalityKeyValue(OUTCOME.withValue("SERVER_ERROR"))
.hasLowCardinalityKeyValue(STATUS.withValue("503"))
.hasLowCardinalityKeyValue(METHOD.withValue("GET"));
assertThat(observationRegistry).hasNumberOfObservationsWithNameEqualTo(DEFAULT_METER_NAME, 2);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void shouldInstrumentReceivedResponses() throws Exception {
handler.execute(request, this.scope, chain);
assertThat(observationRegistry).hasObservationWithNameEqualTo("httpcomponents.httpclient.request")
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "SUCCESS");
.hasLowCardinalityKeyValue(OUTCOME.withValue("SUCCESS"));
}

@Test
Expand All @@ -95,8 +95,8 @@ void shouldInstrumentExceptions() throws Exception {
.isInstanceOf(IllegalArgumentException.class);
assertThat(observationRegistry).hasObservationWithNameEqualTo("httpcomponents.httpclient.request")
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "UNKNOWN")
.hasLowCardinalityKeyValue(EXCEPTION.asString(), "IllegalArgumentException");
.hasLowCardinalityKeyValue(OUTCOME.withValue("UNKNOWN"))
.hasLowCardinalityKeyValue(EXCEPTION.withValue("IllegalArgumentException"));
}

@Test
Expand All @@ -108,8 +108,8 @@ void shouldInstrumentCancelledRequests() throws Exception {
.isInstanceOf(RequestFailedException.class);
assertThat(observationRegistry).hasObservationWithNameEqualTo("httpcomponents.httpclient.request")
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "UNKNOWN")
.hasLowCardinalityKeyValue(EXCEPTION.asString(), "RequestFailedException");
.hasLowCardinalityKeyValue(OUTCOME.withValue("UNKNOWN"))
.hasLowCardinalityKeyValue(EXCEPTION.withValue("RequestFailedException"));
}

}
Expand Down Expand Up @@ -138,7 +138,7 @@ void shouldInstrumentReceivedResponses() throws Exception {

assertThat(observationRegistry).hasObservationWithNameEqualTo("httpcomponents.httpclient.request")
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "SUCCESS");
.hasLowCardinalityKeyValue(OUTCOME.withValue("SUCCESS"));
}

@Test
Expand All @@ -151,8 +151,8 @@ void shouldInstrumentExceptions() throws Exception {

assertThat(observationRegistry).hasObservationWithNameEqualTo("httpcomponents.httpclient.request")
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "UNKNOWN")
.hasLowCardinalityKeyValue(EXCEPTION.asString(), "IllegalArgumentException");
.hasLowCardinalityKeyValue(OUTCOME.withValue("UNKNOWN"))
.hasLowCardinalityKeyValue(EXCEPTION.withValue("IllegalArgumentException"));
}

@Test
Expand All @@ -164,8 +164,8 @@ void shouldInstrumentCancelledRequests() throws Exception {

assertThat(observationRegistry).hasObservationWithNameEqualTo("httpcomponents.httpclient.request")
.that()
.hasLowCardinalityKeyValue(OUTCOME.asString(), "UNKNOWN")
.hasLowCardinalityKeyValue(EXCEPTION.asString(), KeyValue.NONE_VALUE);
.hasLowCardinalityKeyValue(OUTCOME.withValue("UNKNOWN"))
.hasLowCardinalityKeyValue(EXCEPTION.withValue(KeyValue.NONE_VALUE));
}

}
Expand Down

0 comments on commit eda8b11

Please sign in to comment.