|
|
@ -104,18 +104,17 @@ public class PropertiesMeterFilter implements MeterFilter {
|
|
|
|
if (values.isEmpty()) {
|
|
|
|
if (values.isEmpty()) {
|
|
|
|
return defaultValue;
|
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return this.baseLookup(values, id, () -> defaultValue);
|
|
|
|
return doLookup(values, id, () -> defaultValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private <T> T lookupWithFallbackToAll(Map<String, T> values, Id id, T defaultValue) {
|
|
|
|
private <T> T lookupWithFallbackToAll(Map<String, T> values, Id id, T defaultValue) {
|
|
|
|
if (values.isEmpty()) {
|
|
|
|
if (values.isEmpty()) {
|
|
|
|
return defaultValue;
|
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return this.baseLookup(values, id,
|
|
|
|
return doLookup(values, id, () -> values.getOrDefault("all", defaultValue));
|
|
|
|
() -> values.getOrDefault("all", defaultValue));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private <T> T baseLookup(Map<String, T> values, Id id, Supplier<T> defaultValue) {
|
|
|
|
private <T> T doLookup(Map<String, T> values, Id id, Supplier<T> defaultValue) {
|
|
|
|
String name = id.getName();
|
|
|
|
String name = id.getName();
|
|
|
|
while (StringUtils.hasLength(name)) {
|
|
|
|
while (StringUtils.hasLength(name)) {
|
|
|
|
T result = values.get(name);
|
|
|
|
T result = values.get(name);
|
|
|
|