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 2021/09/24 05:32:43 UTC
[skywalking] branch master updated: Fix `Hour`/`Day` dimensionality
metrics and `Slow SQL sampling` are not accurate (#7787)
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 8f9a192 Fix `Hour`/`Day` dimensionality metrics and `Slow SQL sampling` are not accurate (#7787)
8f9a192 is described below
commit 8f9a19213c03c4d6d63078a8238207937c1ed59b
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Fri Sep 24 13:32:30 2021 +0800
Fix `Hour`/`Day` dimensionality metrics and `Slow SQL sampling` are not accurate (#7787)
---
CHANGES.md | 9 +++++++--
.../server/core/analysis/worker/MetricsPersistentWorker.java | 5 +++--
.../oap/server/core/analysis/worker/PersistenceWorker.java | 10 +---------
.../skywalking/oap/server/core/analysis/worker/TopNWorker.java | 7 ++-----
4 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 750edca..2001f7d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -8,7 +8,7 @@ Release Notes.
#### Project
* Split javaagent into skywalking-java repository. https://github.com/apache/skywalking-java
-* Merge `Dockerfile`s from apache/skywalking-docker into this codebase.
+* Merge `Dockerfile`s from apache/skywalking-docker into this codebase.
#### OAP Server
@@ -31,7 +31,8 @@ Release Notes.
* [Break Change] Remove endpoint name in the backend log query condition. Only support `query by endpoint id`.
* [Break Change] Fix typo for a column `page_path_id`(was `pate_path_id`) of storage entity `browser_error_log`.
* Add component id for Python falcon plugin.
-* Add `rpcStatusCode` for `rpc.status_code` tag. The `responseCode` field is marked as deprecated and replaced by `httpResponseStatusCode` field.
+* Add `rpcStatusCode` for `rpc.status_code` tag. The `responseCode` field is marked as deprecated and replaced
+ by `httpResponseStatusCode` field.
* Remove the duplicated tags to reduce the storage payload.
* Add a new API to test log analysis language.
* Harden the security of Groovy-based DSL, MAL and LAL.
@@ -70,6 +71,10 @@ Release Notes.
* Fix wrong service name when IP is node IP in `k8s-mesh`.
* Support dynamic configurations for openAPI endpoint name grouping rule.
* Add component definition for `Alibaba Druid` and `HikariCP`.
+* Fix `Hour` and `Day` dimensionality metrics not accurate, due to the cache read-then-clear mechanism conflicts with low
+ down metrics flush period added in 8.7.0.
+* Fix `Slow SQL sampling` not accurate, due to TopN works conflict with cache read-then-clear mechanism.
+* The persistent cache is only read when necessary.
#### UI
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java
index dbbc451..259cd87 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java
@@ -19,7 +19,6 @@
package org.apache.skywalking.oap.server.core.analysis.worker;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -160,11 +159,13 @@ public class MetricsPersistentWorker extends PersistenceWorker<Metrics> {
}
@Override
- public List<PrepareRequest> prepareBatch(Collection<Metrics> lastCollection) {
+ public List<PrepareRequest> buildBatchRequests() {
if (persistentCounter++ % persistentMod != 0) {
return Collections.EMPTY_LIST;
}
+ final List<Metrics> lastCollection = getCache().read();
+
long start = System.currentTimeMillis();
if (lastCollection.size() == 0) {
return Collections.EMPTY_LIST;
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/PersistenceWorker.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/PersistenceWorker.java
index 2ce8725..ad14009 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/PersistenceWorker.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/PersistenceWorker.java
@@ -18,7 +18,6 @@
package org.apache.skywalking.oap.server.core.analysis.worker;
-import java.util.Collection;
import java.util.List;
import lombok.AccessLevel;
import lombok.Getter;
@@ -61,13 +60,6 @@ public abstract class PersistenceWorker<INPUT extends StorageData> extends Abstr
/**
* Prepare the batch persistence, transfer all prepared data to the executable data format based on the storage
* implementations.
- *
- * @param lastCollection the source of transformation, they are in memory object format.
*/
- public abstract List<PrepareRequest> prepareBatch(Collection<INPUT> lastCollection);
-
- public List<PrepareRequest> buildBatchRequests() {
- final List<INPUT> dataList = getCache().read();
- return prepareBatch(dataList);
- }
+ public abstract List<PrepareRequest> buildBatchRequests();
}
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/TopNWorker.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/TopNWorker.java
index e224e62..4b9c407 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/TopNWorker.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/TopNWorker.java
@@ -19,7 +19,6 @@
package org.apache.skywalking.oap.server.core.analysis.worker;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
@@ -71,11 +70,9 @@ public class TopNWorker extends PersistenceWorker<TopN> {
return Collections.EMPTY_LIST;
}
lastReportTimestamp = now;
- return super.buildBatchRequests();
- }
- @Override
- public List<PrepareRequest> prepareBatch(Collection<TopN> lastCollection) {
+ final List<TopN> lastCollection = getCache().read();
+
List<PrepareRequest> prepareRequests = new ArrayList<>(lastCollection.size());
lastCollection.forEach(record -> {
try {