[feature](profile) add RuntimeFilterInfo in merge profile #27869

This commit is contained in:
Mryange
2023-12-01 21:42:25 +08:00
committed by GitHub
parent fcfd0aa8e0
commit 68525fc112
7 changed files with 39 additions and 4 deletions

View File

@ -35,6 +35,9 @@ public class AggCounter extends Counter {
}
public void addCounter(Counter counter) {
if (counter == null) {
return;
}
if (number == 0) {
max.setValue(counter.getValue());
sum.setValue(counter.getValue());

View File

@ -484,19 +484,18 @@ public class RuntimeProfile {
}
}
private static void mergeCounters(String counterName, List<RuntimeProfile> profiles,
private static void mergeCounters(String parentCounterName, List<RuntimeProfile> profiles,
RuntimeProfile simpleProfile) {
if (profiles.size() == 0) {
return;
}
RuntimeProfile templateProfile = profiles.get(0);
Set<String> childCounterSet = templateProfile.childCounterMap.get(counterName);
Set<String> childCounterSet = templateProfile.childCounterMap.get(parentCounterName);
if (childCounterSet == null) {
return;
}
for (String childCounterName : childCounterSet) {
Counter counter = templateProfile.counterMap.get(childCounterName);
mergeCounters(childCounterName, profiles, simpleProfile);
if (counter.getLevel() == 1) {
Counter oldCounter = profiles.get(0).counterMap.get(childCounterName);
AggCounter aggCounter = new AggCounter(oldCounter.getType());
@ -504,8 +503,13 @@ public class RuntimeProfile {
Counter orgCounter = profile.counterMap.get(childCounterName);
aggCounter.addCounter(orgCounter);
}
simpleProfile.addCounter(childCounterName, aggCounter, ROOT_COUNTER);
if (simpleProfile.counterMap.containsKey(parentCounterName)) {
simpleProfile.addCounter(childCounterName, aggCounter, parentCounterName);
} else {
simpleProfile.addCounter(childCounterName, aggCounter, ROOT_COUNTER);
}
}
mergeCounters(childCounterName, profiles, simpleProfile);
}
}