未验证 提交 afe4cb0c 编写于 作者: W wankai123 提交者: GitHub

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

上级 dfd7ebdc
......@@ -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.
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册