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/10/28 02:18:23 UTC

[skywalking] branch master updated: Make new TimeBucket in ElasticSearch compatible with old versions. (#8027)

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 50cc044  Make new TimeBucket in ElasticSearch compatible with old versions. (#8027)
50cc044 is described below

commit 50cc044571a8bae6ec28eecc0e046b77ee58352c
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Thu Oct 28 10:18:01 2021 +0800

    Make new TimeBucket in ElasticSearch compatible with old versions. (#8027)
---
 CHANGES.md                                                           | 1 +
 .../oap/server/core/analysis/manual/service/ServiceTraffic.java      | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 6a190a4..e589d53 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -57,6 +57,7 @@ Release Notes.
 * Fix unexpected deleting due to TTL mechanism bug for H2, MySQL, TiDB and PostgreSQL.
 * Add a GraphQL query to get OAP version, display OAP version in startup message and error logs.
 * Fix TimeBucket missing in H2, MySQL, TiDB and PostgreSQL bug, which causes TTL doesn't work for `service_traffic`.
+* Fix TimeBucket missing in ElasticSearch and provide compatible `storage2Entity` for previous versions.
 * Fix ElasticSearch implementation of `queryMetricsValues` and `readLabeledMetricsValues` doesn't fill default values
   when no available data in the ElasticSearch server.
 
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/service/ServiceTraffic.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/service/ServiceTraffic.java
index 74b3865..9e78d86 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/service/ServiceTraffic.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/service/ServiceTraffic.java
@@ -100,7 +100,10 @@ public class ServiceTraffic extends Metrics {
             serviceTraffic.setName((String) dbMap.get(NAME));
             serviceTraffic.setNodeType(NodeType.valueOf(((Number) dbMap.get(NODE_TYPE)).intValue()));
             serviceTraffic.setGroup((String) dbMap.get(GROUP));
-            serviceTraffic.setTimeBucket(((Number) dbMap.get(TIME_BUCKET)).longValue());
+            // TIME_BUCKET column could be null in old implementation, which is fixed in 8.9.0
+            if (dbMap.containsKey(TIME_BUCKET)) {
+                serviceTraffic.setTimeBucket(((Number) dbMap.get(TIME_BUCKET)).longValue());
+            }
             return serviceTraffic;
         }