You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2018/06/28 05:49:30 UTC
[incubator-skywalking] branch master updated: [Collector] Segment
duration query error. (#1400)
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/incubator-skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 9b14d59 [Collector] Segment duration query error. (#1400)
9b14d59 is described below
commit 9b14d59c4cb18a192df50e6b3cb70ccad7e9a9d3
Author: 彭勇升 pengys <80...@qq.com>
AuthorDate: Thu Jun 28 13:49:26 2018 +0800
[Collector] Segment duration query error. (#1400)
* Fixed the wrong usage of elasticsearch filter.
* #1393
The array data type of service name column are nested. Change the data type to be just a one-dimensional array.
---
.../storage/es/dao/SegmentDurationEsPersistenceDAO.java | 2 +-
.../collector/storage/es/dao/ui/SegmentDurationEsUIDAO.java | 12 ++----------
2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/SegmentDurationEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/SegmentDurationEsPersistenceDAO.java
index 9814964..5d8d12b 100644
--- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/SegmentDurationEsPersistenceDAO.java
+++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/SegmentDurationEsPersistenceDAO.java
@@ -56,7 +56,7 @@ public class SegmentDurationEsPersistenceDAO extends EsDAO implements ISegmentDu
XContentBuilder target = XContentFactory.jsonBuilder().startObject()
.field(SegmentDurationTable.SEGMENT_ID.getName(), data.getSegmentId())
.field(SegmentDurationTable.APPLICATION_ID.getName(), data.getApplicationId())
- .array(SegmentDurationTable.SERVICE_NAME.getName(), data.getServiceName())
+ .field(SegmentDurationTable.SERVICE_NAME.getName(), data.getServiceName())
.field(SegmentDurationTable.DURATION.getName(), data.getDuration())
.field(SegmentDurationTable.START_TIME.getName(), data.getStartTime())
.field(SegmentDurationTable.END_TIME.getName(), data.getEndTime())
diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/SegmentDurationEsUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/SegmentDurationEsUIDAO.java
index 7e65b47..62d9b62 100644
--- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/SegmentDurationEsUIDAO.java
+++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/SegmentDurationEsUIDAO.java
@@ -18,8 +18,7 @@
package org.apache.skywalking.apm.collector.storage.es.dao.ui;
-import com.google.gson.Gson;
-import java.util.*;
+import java.util.List;
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
import org.apache.skywalking.apm.collector.core.util.*;
import org.apache.skywalking.apm.collector.storage.dao.ui.ISegmentDurationUIDAO;
@@ -36,8 +35,6 @@ import org.elasticsearch.search.sort.SortOrder;
*/
public class SegmentDurationEsUIDAO extends EsDAO implements ISegmentDurationUIDAO {
- private final Gson gson = new Gson();
-
public SegmentDurationEsUIDAO(ElasticSearchClient client) {
super(client);
}
@@ -105,12 +102,7 @@ public class SegmentDurationEsUIDAO extends EsDAO implements ISegmentDurationUID
basicTrace.setSegmentId((String)searchHit.getSource().get(SegmentDurationTable.SEGMENT_ID.getName()));
basicTrace.setStart(((Number)searchHit.getSource().get(SegmentDurationTable.START_TIME.getName())).longValue());
-
- String serviceNameJsonStr = (String)searchHit.getSource().get(SegmentDurationTable.SERVICE_NAME.getName());
- if (StringUtils.isNotEmpty(serviceNameJsonStr)) {
- List serviceNames = gson.fromJson(serviceNameJsonStr, LinkedList.class);
- basicTrace.getOperationName().addAll(serviceNames);
- }
+ basicTrace.getOperationName().addAll((List)searchHit.getSource().get(SegmentDurationTable.SERVICE_NAME.getName()));
basicTrace.setDuration(((Number)searchHit.getSource().get(SegmentDurationTable.DURATION.getName())).intValue());
basicTrace.setError(BooleanUtils.valueToBoolean(((Number)searchHit.getSource().get(SegmentDurationTable.IS_ERROR.getName())).intValue()));
traceBrief.getTraces().add(basicTrace);