Skip to content

Commit b949eec

Browse files
Document rationale for gateway client observation metric name
Explains on DefaultGatewayObservationConvention#getName() why the metric is prefixed with 'spring.cloud.gateway.' so a future reader does not revert the rename without understanding the Prometheus collision it avoids. See gh-3153 Signed-off-by: JOOYOUNG JUNG <143606756+LivingLikeKrillin@users.noreply.github.com>
1 parent 1d9174a commit b949eec

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

spring-cloud-gateway-server-webflux/src/main/java/org/springframework/cloud/gateway/filter/headers/observation/DefaultGatewayObservationConvention.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ public KeyValues getHighCardinalityKeyValues(GatewayContext context) {
7070
return KeyValues.of(URI.withValue(context.getRequest().getURI().toString()));
7171
}
7272

73+
/**
74+
* The {@code spring.cloud.gateway.} prefix avoids a metric name collision with Spring
75+
* Web's {@code DefaultClientRequestObservationConvention}, which uses
76+
* {@code http.client.requests} for {@code WebClient} requests with a different
77+
* low-cardinality label set. Without it, Prometheus refuses to register one of the
78+
* two meters and a metric series is dropped.
79+
* @see <a href=
80+
* "https://github.com/spring-cloud/spring-cloud-gateway/issues/3153">gh-3153</a>
81+
*/
7382
@Override
7483
public String getName() {
7584
return "spring.cloud.gateway.http.client.requests";

0 commit comments

Comments
 (0)