Skip to content

Commit 799dc9c

Browse files
committed
Merge branch '4.3.x'
2 parents e9a7079 + 2246921 commit 799dc9c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/modules/ROOT/pages/spring-cloud-gateway-server-webflux/global-filters.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ This filter adds a timer metric named `spring.cloud.gateway.requests` with the f
5252
* `httpStatusCode`: The HTTP Status of the request returned to the client.
5353
* `httpMethod`: The HTTP method used for the request.
5454

55-
In addition, through the `spring.cloud.gateway.metrics.tags.path.enabled` property (by default, `false`), you can activate an extra metric with the path tag:
55+
In addition, through the `spring.cloud.gateway.server.webflux.metrics.path-tags.enabled` property (by default, `false`), you can activate an extra metric with the path tag:
5656

5757
* `path`: The path of the request.
5858

59+
WARNING: The property `spring.cloud.gateway.server.webflux.metrics.tags.path.enabled` will also add the above metric but has the side effect of the value ending up as a tag. This property is deprecated and will be removed in a future release.
60+
5961
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].
6062
You can also alarm with these useful metrics to take an example from link:gateway-alarming.adoc[alarming-template].
6163

spring-cloud-gateway-server-webflux/src/main/java/org/springframework/cloud/gateway/config/GatewayMetricsAutoConfiguration.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
2929
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
3030
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
31+
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
3132
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
3233
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3334
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -71,8 +72,10 @@ public GatewayHttpTagsProvider gatewayHttpTagsProvider() {
7172
return new GatewayHttpTagsProvider();
7273
}
7374

75+
// TODO: remove support for the property `metrics.tags.path.enabled` in the next major
7476
@Bean
75-
@ConditionalOnProperty(name = GatewayProperties.PREFIX + ".metrics.tags.path.enabled")
77+
@ConditionalOnExpression("'${" + GatewayProperties.PREFIX + ".metrics.tags.path.enabled:false}' == 'true' || '${"
78+
+ GatewayProperties.PREFIX + ".metrics.path-tags.enabled:false}' == 'true'")
7679
public GatewayPathTagsProvider gatewayPathTagsProvider() {
7780
return new GatewayPathTagsProvider();
7881
}

0 commit comments

Comments
 (0)