Merge branch 'fix-timer-metric-name' of https://github.com/abelsromero/spring-cloud-gateway into abelsromero-fix-timer-metric-name

This commit is contained in:
spencergibb
2021-10-06 19:50:40 -04:00
2 changed files with 3 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ import org.springframework.web.reactive.function.server.ServerResponse;
@Import(AdditionalRoutesImportSelector.class)
public class GatewaySampleApplication {
public static final String HELLO_FROM_FAKE_ACTUATOR_METRICS_GATEWAY_REQUESTS = "hello from fake /actuator/metrics/gateway.requests";
public static final String HELLO_FROM_FAKE_ACTUATOR_METRICS_GATEWAY_REQUESTS = "hello from fake /actuator/metrics/spring.cloud.gateway.requests";
@Value("${test.uri:http://httpbin.org:80}")
String uri;
@@ -165,7 +165,7 @@ public class GatewaySampleApplication {
@Bean
public RouterFunction<ServerResponse> testWhenMetricPathIsNotMeet() {
RouterFunction<ServerResponse> route = RouterFunctions
.route(RequestPredicates.path("/actuator/metrics/gateway.requests"), request -> ServerResponse.ok()
.route(RequestPredicates.path("/actuator/metrics/spring.cloud.gateway.requests"), request -> ServerResponse.ok()
.body(BodyInserters.fromValue(HELLO_FROM_FAKE_ACTUATOR_METRICS_GATEWAY_REQUESTS)));
return route;
}

View File

@@ -71,7 +71,7 @@ public class GatewaySampleApplicationWithoutMetricsTests {
public void actuatorMetrics() {
init(TestConfig.class);
webClient.get().uri("/get").exchange().expectStatus().isOk();
webClient.get().uri("http://localhost:" + port + "/actuator/metrics/gateway.requests").exchange().expectStatus()
webClient.get().uri("http://localhost:" + port + "/actuator/metrics/spring.cloud.gateway.requests").exchange().expectStatus()
.isOk().expectBody(String.class)
.isEqualTo(GatewaySampleApplication.HELLO_FROM_FAKE_ACTUATOR_METRICS_GATEWAY_REQUESTS);
}