You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2018/06/28 05:49:28 UTC

[GitHub] wu-sheng closed pull request #1400: [Collector] Segment duration query error.

wu-sheng closed pull request #1400: [Collector] Segment duration query error.
URL: https://github.com/apache/incubator-skywalking/pull/1400
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 98149649b..5d8d12b0a 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 IndexRequestBuilder prepareBatchInsert(SegmentDuration data) throws IOExc
         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 7e65b4721..62d9b6289 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 @@
  */
 public class SegmentDurationEsUIDAO extends EsDAO implements ISegmentDurationUIDAO {
 
-    private final Gson gson = new Gson();
-
     public SegmentDurationEsUIDAO(ElasticSearchClient client) {
         super(client);
     }
@@ -105,12 +102,7 @@ public TraceBrief loadTop(long startSecondTimeBucket, long endSecondTimeBucket,
 
             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);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services