[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.
This commit is contained in:
parent
8b385d0ed2
commit
9b14d59c4c
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue