fix: Some incompatibles check codes didn't work in `PercentileFunction combine` (#6851)

This commit is contained in:
wankai123 2021-04-27 15:13:24 +08:00 committed by GitHub
parent dfd7ebdc73
commit afe4cb0c0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 10 deletions

View File

@ -25,6 +25,7 @@ Release Notes.
* Loop alarm into event system.
* Support alarm tags.
* Support WeLink as a channel of alarm notification.
* Fix: Some defensive codes didn't work in `PercentileFunction combine`.
#### UI
* Add logo for kong plugin.

View File

@ -131,16 +131,16 @@ public abstract class PercentileFunction extends Metrics implements AcceptableVa
);
return true;
}
if (ranks.size() > 0) {
if (this.ranks.size() > 0) {
IntList ranksOfThat = percentile.getRanks();
if (this.ranks.size() != ranks.size()) {
if (this.ranks.size() != ranksOfThat.size()) {
log.warn("Incompatible ranks size = [{}}] for current PercentileFunction[{}]",
ranks.size(), this.ranks.size()
ranksOfThat.size(), this.ranks.size()
);
return true;
} else {
if (!this.ranks.equals(percentile.getRanks())) {
log.warn("Rank {} doesn't exist in the previous ranks {}", percentile.getRanks(), ranks);
if (!this.ranks.equals(ranksOfThat)) {
log.warn("Rank {} doesn't exist in the previous ranks {}", ranksOfThat, this.ranks);
return true;
}
}

View File

@ -157,15 +157,16 @@ public abstract class AvgHistogramPercentileFunction extends Metrics implements
public boolean combine(final Metrics metrics) {
AvgHistogramPercentileFunction percentile = (AvgHistogramPercentileFunction) metrics;
if (ranks.size() > 0) {
if (this.ranks.size() != ranks.size()) {
if (this.ranks.size() > 0) {
IntList ranksOfThat = percentile.getRanks();
if (this.ranks.size() != ranksOfThat.size()) {
log.warn("Incompatible ranks size = [{}}] for current PercentileFunction[{}]",
ranks.size(), this.ranks.size()
ranksOfThat.size(), this.ranks.size()
);
return true;
} else {
if (!this.ranks.equals(percentile.getRanks())) {
log.warn("Rank {} doesn't exist in the previous ranks {}", percentile.getRanks(), ranks);
if (!this.ranks.equals(ranksOfThat)) {
log.warn("Rank {} doesn't exist in the previous ranks {}", ranksOfThat, this.ranks);
return true;
}
}