Updates default metrics prefix to spring.cloud.gateway.
See gh-1981
This commit is contained in:
@@ -127,7 +127,7 @@ public class GatewayProperties {
|
||||
/**
|
||||
* Default metrics prefix.
|
||||
*/
|
||||
public static final String DEFAULT_PREFIX = "gateway";
|
||||
public static final String DEFAULT_PREFIX = "spring.cloud.gateway";
|
||||
|
||||
/**
|
||||
* Enables the collection of metrics data.
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.cloud.gateway.config.GatewayProperties;
|
||||
import org.springframework.cloud.gateway.support.tagsprovider.GatewayTagsProvider;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
@@ -46,13 +45,8 @@ public class GatewayMetricsFilter implements GlobalFilter, Ordered {
|
||||
|
||||
private final String metricsPrefix;
|
||||
|
||||
@Deprecated
|
||||
public GatewayMetricsFilter(MeterRegistry meterRegistry, List<GatewayTagsProvider> tagsProviders) {
|
||||
this(meterRegistry, tagsProviders, GatewayProperties.Metrics.DEFAULT_PREFIX);
|
||||
}
|
||||
|
||||
public GatewayMetricsFilter(MeterRegistry meterRegistry,
|
||||
List<GatewayTagsProvider> tagsProviders, String metricsPrefix) {
|
||||
public GatewayMetricsFilter(MeterRegistry meterRegistry, List<GatewayTagsProvider> tagsProviders,
|
||||
String metricsPrefix) {
|
||||
this.meterRegistry = meterRegistry;
|
||||
this.compositeTagsProvider = tagsProviders.stream().reduce(exchange -> Tags.empty(), GatewayTagsProvider::and);
|
||||
if (metricsPrefix.endsWith(".")) {
|
||||
|
||||
@@ -54,7 +54,7 @@ public class GatewayMetricsAutoConfigurationTests {
|
||||
@Test
|
||||
public void gatewayMetricsBeansExists() {
|
||||
assertThat(filter).isNotNull();
|
||||
assertThat(filter.getMetricsPrefix()).isEqualTo("gateway");
|
||||
assertThat(filter.getMetricsPrefix()).isEqualTo("spring.cloud.gateway");
|
||||
assertThat(tagsProviders).isNotEmpty();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user