Skip to content

Commit 6efb370

Browse files
committed
Introduced FilterSupport for internal MeterFilter implementations
Signed-off-by: etki <[email protected]>
1 parent 169f38a commit 6efb370

File tree

4 files changed

+83
-3
lines changed

4 files changed

+83
-3
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2025 VMware, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.micrometer.core.instrument.config.filter;
17+
18+
class FilterSupport {
19+
/**
20+
* At the moment of writing, it was impossible to estimate tags
21+
* count from the outside of class, but quite often a temporary
22+
* storage (ArrayList) had to be allocated during processing. To
23+
* avoid excessive resizes, this constant is introduced to
24+
* preallocate space for such a list.
25+
*/
26+
public static final int DEFAULT_TAG_COUNT_EXPECTATION = 32;
27+
28+
private FilterSupport() {}
29+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2025 VMware, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.micrometer.core.instrument.config.filter;
17+
18+
import io.micrometer.core.instrument.config.MeterFilter;
19+
20+
/**
21+
* A fallback for all factory methods that have received an input
22+
* functionally equivalent to "abstain from processing".
23+
*
24+
* @since 1.15
25+
*/
26+
public class NoOpFilter implements MeterFilter {
27+
private static final MeterFilter INSTANCE = new NoOpFilter();
28+
29+
private NoOpFilter() {}
30+
31+
public static MeterFilter create() {
32+
return INSTANCE;
33+
}
34+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright 2025 VMware, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.micrometer.core.instrument.config.filter;

micrometer-core/src/test/java/io/micrometer/core/instrument/MeterFilterTest.java renamed to micrometer-core/src/test/java/io/micrometer/core/instrument/config/MeterFilterTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package io.micrometer.core.instrument;
16+
package io.micrometer.core.instrument.config;
1717

1818
import io.micrometer.common.lang.Nullable;
1919
import io.micrometer.core.Issue;
20-
import io.micrometer.core.instrument.config.MeterFilter;
21-
import io.micrometer.core.instrument.config.MeterFilterReply;
20+
import io.micrometer.core.instrument.Meter;
21+
import io.micrometer.core.instrument.MeterRegistry;
22+
import io.micrometer.core.instrument.Tags;
2223
import io.micrometer.core.instrument.distribution.DistributionStatisticConfig;
2324
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
2425
import org.assertj.core.api.Condition;

0 commit comments

Comments
 (0)