This commit is contained in:
parent
7c192b19d6
commit
966d5f54f1
|
|
@ -70,6 +70,7 @@ public class SegmentRecord extends Record {
|
|||
map.put(TRACE_ID, storageData.getTraceId());
|
||||
map.put(SERVICE_ID, storageData.getServiceId());
|
||||
map.put(ENDPOINT_NAME, storageData.getEndpointName());
|
||||
map.put(ENDPOINT_ID, storageData.getEndpointId());
|
||||
map.put(START_TIME, storageData.getStartTime());
|
||||
map.put(END_TIME, storageData.getEndTime());
|
||||
map.put(LATENCY, storageData.getLatency());
|
||||
|
|
@ -89,6 +90,7 @@ public class SegmentRecord extends Record {
|
|||
record.setTraceId((String)dbMap.get(TRACE_ID));
|
||||
record.setServiceId(((Number)dbMap.get(SERVICE_ID)).intValue());
|
||||
record.setEndpointName((String)dbMap.get(ENDPOINT_NAME));
|
||||
record.setEndpointId(((Number)dbMap.get(ENDPOINT_ID)).intValue());
|
||||
record.setStartTime(((Number)dbMap.get(START_TIME)).longValue());
|
||||
record.setEndTime(((Number)dbMap.get(END_TIME)).longValue());
|
||||
record.setLatency(((Number)dbMap.get(LATENCY)).intValue());
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.core.query;
|
|||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
import org.apache.skywalking.apm.util.StringUtil;
|
||||
import org.apache.skywalking.oap.server.core.Const;
|
||||
import org.apache.skywalking.oap.server.core.analysis.indicator.Indicator;
|
||||
import org.apache.skywalking.oap.server.core.query.entity.*;
|
||||
|
|
@ -68,7 +69,11 @@ public class MetricQueryService implements Service {
|
|||
final long endTB) throws IOException, ParseException {
|
||||
List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTB, endTB);
|
||||
List<String> ids = new ArrayList<>();
|
||||
durationPoints.forEach(durationPoint -> ids.add(durationPoint.getPoint() + Const.ID_SPLIT + id));
|
||||
if (StringUtil.isEmpty(id)) {
|
||||
durationPoints.forEach(durationPoint -> ids.add(String.valueOf(durationPoint.getPoint())));
|
||||
} else {
|
||||
durationPoints.forEach(durationPoint -> ids.add(durationPoint.getPoint() + Const.ID_SPLIT + id));
|
||||
}
|
||||
|
||||
return getMetricQueryDAO().getLinearIntValues(indName, step, ids, ValueColumnIds.INSTANCE.getValueCName(indName));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.oap.server.library.util;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import org.slf4j.*;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class TimestampUtils {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TimestampUtils.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Timestamp timestamp = new Timestamp(1483200061001L);
|
||||
logger.info("time: {}", format.format(timestamp));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
~ contributor license agreements. See the NOTICE file distributed with
|
||||
~ this work for additional information regarding copyright ownership.
|
||||
~ The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
~ (the "License"); you may not use this file except in compliance with
|
||||
~ the License. You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
~
|
||||
-->
|
||||
|
||||
<Configuration status="DEBUG">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout charset="UTF-8" pattern="%d - %c -%-4r [%t] %-5p %x - %m%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="DEBUG">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
|
@ -35,5 +35,8 @@ public class InstanceHeartBeatTestCase {
|
|||
builder.setApplicationInstanceId(2);
|
||||
builder.setHeartbeatTime(System.currentTimeMillis() + 5 * 1000 * 60);
|
||||
Downstream heartbeat = stub.heartbeat(builder.build());
|
||||
|
||||
builder.setApplicationInstanceId(3);
|
||||
heartbeat = stub.heartbeat(builder.build());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe
|
|||
long latency = spanDecorator.getEndTime() - spanDecorator.getStartTime();
|
||||
sourceBuilder.setLatency((int)latency);
|
||||
sourceBuilder.setResponseCode(Const.NONE);
|
||||
sourceBuilder.setStatus(spanDecorator.getIsError());
|
||||
sourceBuilder.setStatus(!spanDecorator.getIsError());
|
||||
|
||||
switch (spanDecorator.getSpanLayer()) {
|
||||
case Http:
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ public class SegmentSpanListener implements FirstSpanListener, EntrySpanListener
|
|||
public void parseFirst(SpanDecorator spanDecorator, SegmentCoreInfo segmentCoreInfo) {
|
||||
long timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(segmentCoreInfo.getStartTime());
|
||||
|
||||
segment.setSegmentId(segmentCoreInfo.getSegmentId());
|
||||
segment.setSegmentId(segmentCoreInfo.getSegmentId());
|
||||
segment.setServiceId(segmentCoreInfo.getApplicationId());
|
||||
segment.setLatency((int)(segmentCoreInfo.getEndTime() - segmentCoreInfo.getStartTime()));
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ public class TraceQueryEsDAO extends EsDAO implements ITraceQueryDAO {
|
|||
basicTrace.getEndpointNames().add((String)searchHit.getSourceAsMap().get(SegmentRecord.ENDPOINT_NAME));
|
||||
basicTrace.setDuration(((Number)searchHit.getSourceAsMap().get(SegmentRecord.LATENCY)).intValue());
|
||||
basicTrace.setError(BooleanUtils.valueToBoolean(((Number)searchHit.getSourceAsMap().get(SegmentRecord.IS_ERROR)).intValue()));
|
||||
basicTrace.getTraceIds().add((String)searchHit.getSourceAsMap().get(SegmentRecord.TRACE_ID));
|
||||
traceBrief.getTraces().add(basicTrace);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue