Fix timer metric name in docs
This commit is contained in:
@@ -1856,7 +1856,9 @@ spring:
|
||||
|
||||
=== The Gateway Metrics Filter
|
||||
|
||||
To enable gateway metrics, add spring-boot-starter-actuator as a project dependency. Then, by default, the gateway metrics filter runs as long as the property `spring.cloud.gateway.metrics.enabled` is not set to `false`. This filter adds a timer metric named `gateway.requests` with the following tags:
|
||||
To enable gateway metrics, add spring-boot-starter-actuator as a project dependency.
|
||||
Then, by default, the gateway metrics filter runs as long as the property `spring.cloud.gateway.metrics.enabled` is not set to `false`.
|
||||
This filter adds a timer metric named `spring.cloud.gateway.requests` with the following tags:
|
||||
|
||||
* `routeId`: The route ID.
|
||||
* `routeUri`: The URI to which the API is routed.
|
||||
@@ -1865,7 +1867,7 @@ To enable gateway metrics, add spring-boot-starter-actuator as a project depende
|
||||
* `httpStatusCode`: The HTTP Status of the request returned to the client.
|
||||
* `httpMethod`: The HTTP method used for the request.
|
||||
|
||||
These metrics are then available to be scraped from `/actuator/metrics/gateway.requests` and can be easily integrated with Prometheus to create a link:images/gateway-grafana-dashboard.jpeg[Grafana] link:gateway-grafana-dashboard.json[dashboard].
|
||||
These metrics are then available to be scraped from `/actuator/metrics/spring.cloud.gateway.requests` and can be easily integrated with Prometheus to create a link:images/gateway-grafana-dashboard.jpeg[Grafana] link:gateway-grafana-dashboard.json[dashboard].
|
||||
|
||||
NOTE: To enable the prometheus endpoint, add `micrometer-registry-prometheus` as a project dependency.
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user