diff --git a/multi/multi__global_filters.html b/multi/multi__global_filters.html index 0ef07328..3fceb368 100644 --- a/multi/multi__global_filters.html +++ b/multi/multi__global_filters.html @@ -57,7 +57,7 @@ uri: ws://localhost:3001 predicates: - Path=/websocket/**
-
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:
routeId: The route idrouteUri: The URI that the API will be routed tooutcome |Outcome as classified by HttpStatus.Seriesstatus: Http Status of the request returned to the clientThese metrics are then available to be scraped from /actuator/metrics/gateway.requests and can be easily integated with Prometheus to create a Grafana dashboard.
After the Gateway has routed a ServerWebExchange it will mark that exchange as "routed" by adding gatewayAlreadyRouted
+
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:
routeId: The route idrouteUri: The URI that the API will be routed tooutcome: Outcome as classified by HttpStatus.Seriesstatus: Http Status of the request returned to the clientThese metrics are then available to be scraped from /actuator/metrics/gateway.requests and can be easily integated with Prometheus to create a Grafana dashboard.
![]() | Note |
|---|---|
To enable the pometheus endpoint add micrometer-registry-prometheus as a project dependency. |
After the Gateway has routed a ServerWebExchange it will mark that exchange as "routed" by adding gatewayAlreadyRouted
to the exchange attributes. Once a request has been marked as routed, other routing filters will not route the request again,
essentially skipping the filter. There are convenience methods that you can use to mark an exchange as routed
or check if an exchange has already been routed.
ServerWebExchangeUtils.isAlreadyRouted takes a ServerWebExchange object and checks if it has been "routed"ServerWebExchangeUtils.setAlreadyRouted takes a ServerWebExchange object and marks it as "routed"