You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/10/15 09:32:59 UTC
[skywalking] branch master updated: Fix metrics was put into wrong slot of the window in the alarting kernel (#9789)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 5e275b1bf2 Fix metrics was put into wrong slot of the window in the alarting kernel (#9789)
5e275b1bf2 is described below
commit 5e275b1bf294ea41048a2caabcefba23766c74a6
Author: yangyiweigege <28...@qq.com>
AuthorDate: Sat Oct 15 17:32:42 2022 +0800
Fix metrics was put into wrong slot of the window in the alarting kernel (#9789)
---
docs/en/changes/changes.md | 1 +
.../apache/skywalking/oap/server/core/alarm/provider/AlarmCore.java | 2 +-
.../apache/skywalking/oap/server/core/alarm/provider/RunningRule.java | 4 +++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 6a8bd77354..18fcce430a 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -61,6 +61,7 @@
regardless of the cluster's changes. However with this change SkyWalking can't react to the cluster changes in time, but the delay
is acceptable in our case.
* Optimize the query time of tasks in ProfileTaskCache.
+* Fix metrics was put into wrong slot of the window in the alarting kernel.
#### UI
diff --git a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmCore.java b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmCore.java
index 9f5d09d657..9ff1014805 100644
--- a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmCore.java
+++ b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmCore.java
@@ -72,7 +72,7 @@ public class AlarmCore {
}));
// Set the last execute time, and make sure the second is `00`, such as: 18:30:00
if (hasExecute[0]) {
- lastExecuteTime = checkTime.minusSeconds(checkTime.getSecondOfMinute());
+ lastExecuteTime = checkTime.withSecondOfMinute(0).withMillisOfSecond(0);
}
if (!alarmMessageList.isEmpty()) {
diff --git a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java
index b7ef074d70..2c4261e31e 100644
--- a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java
+++ b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java
@@ -222,7 +222,9 @@ public class RunningRule {
* @param targetTime of moving target
*/
public void moveTo(LocalDateTime targetTime) {
- windows.values().forEach(window -> window.moveTo(targetTime));
+ // Truncate targetTime to minute, make sure the second is `00` and milliseconds is `00` such as: 18:30:00.000
+ final LocalDateTime target = targetTime.withSecondOfMinute(0).withMillisOfSecond(0);
+ windows.values().forEach(window -> window.moveTo(target));
}
/**