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

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

上级 dfd7ebdc
...@@ -25,6 +25,7 @@ Release Notes. ...@@ -25,6 +25,7 @@ Release Notes.
* Loop alarm into event system. * Loop alarm into event system.
* Support alarm tags. * Support alarm tags.
* Support WeLink as a channel of alarm notification. * Support WeLink as a channel of alarm notification.
* Fix: Some defensive codes didn't work in `PercentileFunction combine`.
#### UI #### UI
* Add logo for kong plugin. * Add logo for kong plugin.
......
...@@ -131,16 +131,16 @@ public abstract class PercentileFunction extends Metrics implements AcceptableVa ...@@ -131,16 +131,16 @@ public abstract class PercentileFunction extends Metrics implements AcceptableVa
); );
return true; return true;
} }
if (ranks.size() > 0) { if (this.ranks.size() > 0) {
IntList ranksOfThat = percentile.getRanks(); IntList ranksOfThat = percentile.getRanks();
if (this.ranks.size() != ranks.size()) { if (this.ranks.size() != ranksOfThat.size()) {
log.warn("Incompatible ranks size = [{}}] for current PercentileFunction[{}]", log.warn("Incompatible ranks size = [{}}] for current PercentileFunction[{}]",
ranks.size(), this.ranks.size() ranksOfThat.size(), this.ranks.size()
); );
return true; return true;
} else { } else {
if (!this.ranks.equals(percentile.getRanks())) { if (!this.ranks.equals(ranksOfThat)) {
log.warn("Rank {} doesn't exist in the previous ranks {}", percentile.getRanks(), ranks); log.warn("Rank {} doesn't exist in the previous ranks {}", ranksOfThat, this.ranks);
return true; return true;
} }
} }
......
...@@ -157,15 +157,16 @@ public abstract class AvgHistogramPercentileFunction extends Metrics implements ...@@ -157,15 +157,16 @@ public abstract class AvgHistogramPercentileFunction extends Metrics implements
public boolean combine(final Metrics metrics) { public boolean combine(final Metrics metrics) {
AvgHistogramPercentileFunction percentile = (AvgHistogramPercentileFunction) metrics; AvgHistogramPercentileFunction percentile = (AvgHistogramPercentileFunction) metrics;
if (ranks.size() > 0) { if (this.ranks.size() > 0) {
if (this.ranks.size() != ranks.size()) { IntList ranksOfThat = percentile.getRanks();
if (this.ranks.size() != ranksOfThat.size()) {
log.warn("Incompatible ranks size = [{}}] for current PercentileFunction[{}]", log.warn("Incompatible ranks size = [{}}] for current PercentileFunction[{}]",
ranks.size(), this.ranks.size() ranksOfThat.size(), this.ranks.size()
); );
return true; return true;
} else { } else {
if (!this.ranks.equals(percentile.getRanks())) { if (!this.ranks.equals(ranksOfThat)) {
log.warn("Rank {} doesn't exist in the previous ranks {}", percentile.getRanks(), ranks); log.warn("Rank {} doesn't exist in the previous ranks {}", ranksOfThat, this.ranks);
return true; return true;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册