Skip to content

Commit 827b0c1

Browse files
committed
Rename OnlyOnceLoggingDenyMeterFilter
Rename `OnlyOnceLoggingDenyMeterFilter` to `MaximumAllowableTagsMeterFilter`. Closes gh-47925
1 parent 7849474 commit 827b0c1

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

module/spring-boot-http-client/src/main/java/org/springframework/boot/http/client/autoconfigure/metrics/HttpClientMetricsAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
2424
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2525
import org.springframework.boot.context.properties.EnableConfigurationProperties;
26-
import org.springframework.boot.micrometer.metrics.OnlyOnceLoggingDenyMeterFilter;
26+
import org.springframework.boot.micrometer.metrics.MaximumAllowableTagsMeterFilter;
2727
import org.springframework.boot.micrometer.metrics.autoconfigure.MetricsProperties;
2828
import org.springframework.boot.micrometer.metrics.autoconfigure.MetricsProperties.Web.Client;
2929
import org.springframework.boot.micrometer.observation.autoconfigure.ObservationProperties;
@@ -50,12 +50,12 @@ public final class HttpClientMetricsAutoConfiguration {
5050

5151
@Bean
5252
@Order(0)
53-
OnlyOnceLoggingDenyMeterFilter metricsHttpClientUriTagFilter(ObservationProperties observationProperties,
53+
MaximumAllowableTagsMeterFilter metricsHttpClientUriTagFilter(ObservationProperties observationProperties,
5454
MetricsProperties metricsProperties) {
5555
Client clientProperties = metricsProperties.getWeb().getClient();
5656
String meterNamePrefix = observationProperties.getHttp().getClient().getRequests().getName();
5757
int maxUriTags = clientProperties.getMaxUriTags();
58-
return new OnlyOnceLoggingDenyMeterFilter(meterNamePrefix, "uri", maxUriTags, "Are you using 'uriVariables'?");
58+
return new MaximumAllowableTagsMeterFilter(meterNamePrefix, "uri", maxUriTags, "Are you using 'uriVariables'?");
5959
}
6060

6161
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* @author Phillip Webb
4040
* @since 4.0.0
4141
*/
42-
public final class OnlyOnceLoggingDenyMeterFilter implements MeterFilter {
42+
public final class MaximumAllowableTagsMeterFilter implements MeterFilter {
4343

4444
private final Log logger;
4545

@@ -56,36 +56,36 @@ public final class OnlyOnceLoggingDenyMeterFilter implements MeterFilter {
5656
private final Set<String> observedTagValues = ConcurrentHashMap.newKeySet();
5757

5858
/**
59-
* Create a new {@link OnlyOnceLoggingDenyMeterFilter} with an upper bound on the
59+
* Create a new {@link MaximumAllowableTagsMeterFilter} with an upper bound on the
6060
* number of tags produced by matching metrics.
6161
* @param meterNamePrefix the prefix of the meter name to apply the filter to
6262
* @param tagKey the tag to place an upper bound on
6363
* @param maximumTagValues the total number of tag values that are allowable
6464
*/
65-
public OnlyOnceLoggingDenyMeterFilter(String meterNamePrefix, String tagKey, int maximumTagValues) {
65+
public MaximumAllowableTagsMeterFilter(String meterNamePrefix, String tagKey, int maximumTagValues) {
6666
this(meterNamePrefix, tagKey, maximumTagValues, (String) null);
6767
}
6868

6969
/**
70-
* Create a new {@link OnlyOnceLoggingDenyMeterFilter} with an upper bound on the
70+
* Create a new {@link MaximumAllowableTagsMeterFilter} with an upper bound on the
7171
* number of tags produced by matching metrics.
7272
* @param meterNamePrefix the prefix of the meter name to apply the filter to
7373
* @param tagKey the tag to place an upper bound on
7474
* @param maximumTagValues the total number of tag values that are allowable
7575
* @param hint an additional hint to add to the logged message or {@code null}
7676
*/
77-
public OnlyOnceLoggingDenyMeterFilter(String meterNamePrefix, String tagKey, int maximumTagValues,
77+
public MaximumAllowableTagsMeterFilter(String meterNamePrefix, String tagKey, int maximumTagValues,
7878
@Nullable String hint) {
7979
this(null, meterNamePrefix, tagKey, maximumTagValues,
8080
() -> String.format("Reached the maximum number of '%s' tags for '%s'.%s", tagKey, meterNamePrefix,
8181
(hint != null) ? " " + hint : ""));
8282
}
8383

84-
private OnlyOnceLoggingDenyMeterFilter(@Nullable Log logger, String meterNamePrefix, String tagKey,
84+
private MaximumAllowableTagsMeterFilter(@Nullable Log logger, String meterNamePrefix, String tagKey,
8585
int maximumTagValues, Supplier<String> message) {
8686
Assert.notNull(message, "'message' must not be null");
8787
Assert.isTrue(maximumTagValues >= 0, "'maximumTagValues' must be positive");
88-
this.logger = (logger != null) ? logger : LogFactory.getLog(OnlyOnceLoggingDenyMeterFilter.class);
88+
this.logger = (logger != null) ? logger : LogFactory.getLog(MaximumAllowableTagsMeterFilter.class);
8989
this.meterNamePrefix = meterNamePrefix;
9090
this.maximumTagValues = maximumTagValues;
9191
this.tagKey = tagKey;

module/spring-boot-micrometer-metrics/src/main/java/org/springframework/boot/micrometer/metrics/autoconfigure/MeterRegistryPostProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.springframework.beans.factory.ObjectProvider;
3232
import org.springframework.beans.factory.SmartInitializingSingleton;
3333
import org.springframework.beans.factory.config.BeanPostProcessor;
34-
import org.springframework.boot.micrometer.metrics.OnlyOnceLoggingDenyMeterFilter;
34+
import org.springframework.boot.micrometer.metrics.MaximumAllowableTagsMeterFilter;
3535
import org.springframework.boot.util.LambdaSafe;
3636
import org.springframework.context.ApplicationContext;
3737

@@ -114,7 +114,7 @@ private void applyFilters(MeterRegistry meterRegistry) {
114114
if (this.filters != null) {
115115
Stream<MeterFilter> filters = this.filters.orderedStream();
116116
if (isAutoConfiguredComposite(meterRegistry)) {
117-
filters = filters.filter(OnlyOnceLoggingDenyMeterFilter.class::isInstance);
117+
filters = filters.filter(MaximumAllowableTagsMeterFilter.class::isInstance);
118118
}
119119
filters.forEach(meterRegistry.config()::meterFilter);
120120
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@
2929
import static org.assertj.core.api.Assertions.assertThat;
3030

3131
/**
32-
* Tests for {@link OnlyOnceLoggingDenyMeterFilter}.
32+
* Tests for {@link MaximumAllowableTagsMeterFilter}.
3333
*
3434
* @author Phillip Webb
3535
*/
36-
class OnlyOnceLoggingDenyMeterFilterTests {
36+
class MaximumAllowableTagsMeterFilterTests {
3737

3838
@Test
3939
void applyWhenNameDoesNotHavePrefixReturnsNeutral() {
40-
OnlyOnceLoggingDenyMeterFilter filter = new OnlyOnceLoggingDenyMeterFilter("test", "k", 1);
40+
MaximumAllowableTagsMeterFilter filter = new MaximumAllowableTagsMeterFilter("test", "k", 1);
4141
assertThat(filter.accept(meterId("tset", "k", "v"))).isEqualTo(MeterFilterReply.NEUTRAL);
4242
assertThat(filter).extracting("observedTagValues").asInstanceOf(InstanceOfAssertFactories.COLLECTION).isEmpty();
4343
}
4444

4545
@Test
4646
void applyWhenNameHasPrefixButNoTagKeyReturnsNeutral() {
47-
OnlyOnceLoggingDenyMeterFilter filter = new OnlyOnceLoggingDenyMeterFilter("test", "k", 1);
47+
MaximumAllowableTagsMeterFilter filter = new MaximumAllowableTagsMeterFilter("test", "k", 1);
4848
assertThat(filter.accept(meterId("test", "k", "v"))).isEqualTo(MeterFilterReply.NEUTRAL);
4949
assertThat(filter).extracting("observedTagValues")
5050
.asInstanceOf(InstanceOfAssertFactories.COLLECTION)
@@ -53,7 +53,7 @@ void applyWhenNameHasPrefixButNoTagKeyReturnsNeutral() {
5353

5454
@Test
5555
void applyWhenNameHasPrefixAndTagKeyReturnsNeutralUntilLimit() {
56-
OnlyOnceLoggingDenyMeterFilter filter = new OnlyOnceLoggingDenyMeterFilter("test", "k", 1);
56+
MaximumAllowableTagsMeterFilter filter = new MaximumAllowableTagsMeterFilter("test", "k", 1);
5757
assertThat(filter.accept(meterId("test", "k", "v1"))).isEqualTo(MeterFilterReply.NEUTRAL);
5858
assertThat(filter.accept(meterId("test", "k", "v2"))).isEqualTo(MeterFilterReply.DENY);
5959
assertThat(filter.accept(meterId("test", "k", "v3"))).isEqualTo(MeterFilterReply.DENY);

module/spring-boot-micrometer-metrics/src/test/java/org/springframework/boot/micrometer/metrics/autoconfigure/MeterRegistryPostProcessorTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import org.springframework.beans.BeansException;
3939
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
4040
import org.springframework.beans.factory.ObjectProvider;
41-
import org.springframework.boot.micrometer.metrics.OnlyOnceLoggingDenyMeterFilter;
41+
import org.springframework.boot.micrometer.metrics.MaximumAllowableTagsMeterFilter;
4242
import org.springframework.boot.micrometer.metrics.autoconfigure.MeterRegistryPostProcessor.CompositeMeterRegistries;
4343

4444
import static org.assertj.core.api.Assertions.assertThat;
@@ -136,7 +136,7 @@ void postProcessAndInitializeAppliesFilter() {
136136

137137
@Test
138138
void postProcessAndInitializeOnlyAppliesLmiitedFiltersToAutoConfigured() {
139-
OnlyOnceLoggingDenyMeterFilter onlyOnceFilter = mock();
139+
MaximumAllowableTagsMeterFilter onlyOnceFilter = mock();
140140
this.filters.add(this.mockFilter);
141141
this.filters.add(onlyOnceFilter);
142142
MeterRegistryPostProcessor processor = new MeterRegistryPostProcessor(CompositeMeterRegistries.AUTO_CONFIGURED,

module/spring-boot-webflux/src/main/java/org/springframework/boot/webflux/autoconfigure/WebFluxObservationAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
2929
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
3030
import org.springframework.boot.context.properties.EnableConfigurationProperties;
31-
import org.springframework.boot.micrometer.metrics.OnlyOnceLoggingDenyMeterFilter;
31+
import org.springframework.boot.micrometer.metrics.MaximumAllowableTagsMeterFilter;
3232
import org.springframework.boot.micrometer.metrics.autoconfigure.MetricsProperties;
3333
import org.springframework.boot.micrometer.observation.autoconfigure.ObservationProperties;
3434
import org.springframework.context.annotation.Bean;
@@ -63,10 +63,10 @@ public final class WebFluxObservationAutoConfiguration {
6363

6464
@Bean
6565
@Order(0)
66-
OnlyOnceLoggingDenyMeterFilter metricsHttpServerUriTagFilter(MetricsProperties metricsProperties) {
66+
MaximumAllowableTagsMeterFilter metricsHttpServerUriTagFilter(MetricsProperties metricsProperties) {
6767
String meterNamePrefix = this.observationProperties.getHttp().getServer().getRequests().getName();
6868
int maxUriTags = metricsProperties.getWeb().getServer().getMaxUriTags();
69-
return new OnlyOnceLoggingDenyMeterFilter(meterNamePrefix, "uri", maxUriTags);
69+
return new MaximumAllowableTagsMeterFilter(meterNamePrefix, "uri", maxUriTags);
7070
}
7171

7272
@Bean

module/spring-boot-webmvc/src/main/java/org/springframework/boot/webmvc/autoconfigure/WebMvcObservationAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
3131
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
3232
import org.springframework.boot.context.properties.EnableConfigurationProperties;
33-
import org.springframework.boot.micrometer.metrics.OnlyOnceLoggingDenyMeterFilter;
33+
import org.springframework.boot.micrometer.metrics.MaximumAllowableTagsMeterFilter;
3434
import org.springframework.boot.micrometer.metrics.autoconfigure.MetricsProperties;
3535
import org.springframework.boot.micrometer.observation.autoconfigure.ObservationProperties;
3636
import org.springframework.boot.web.servlet.FilterRegistrationBean;
@@ -85,11 +85,11 @@ static class MeterFilterConfiguration {
8585

8686
@Bean
8787
@Order(0)
88-
OnlyOnceLoggingDenyMeterFilter metricsHttpServerUriTagFilter(ObservationProperties observationProperties,
88+
MaximumAllowableTagsMeterFilter metricsHttpServerUriTagFilter(ObservationProperties observationProperties,
8989
MetricsProperties metricsProperties) {
9090
String meterNamePrefix = observationProperties.getHttp().getServer().getRequests().getName();
9191
int maxUriTags = metricsProperties.getWeb().getServer().getMaxUriTags();
92-
return new OnlyOnceLoggingDenyMeterFilter(meterNamePrefix, "uri", maxUriTags);
92+
return new MaximumAllowableTagsMeterFilter(meterNamePrefix, "uri", maxUriTags);
9393
}
9494

9595
}

0 commit comments

Comments
 (0)