...
|
...
|
@@ -88,6 +88,7 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { |
|
|
spanInfo.setEndpoint(logEvent);
|
|
|
spanInfo.setIp(spans.getHost().getAddress());
|
|
|
spanInfo.setReceive(spans.getReceive());
|
|
|
spanInfo.setTags(span.tags());
|
|
|
spanInfoList.add(new Tuple2<>(spanInfo.getTraceid(), spanInfo));
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -256,7 +257,7 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { |
|
|
@Override
|
|
|
public void call(JavaPairRDD<String, ApiTraceResult> apiResultRdd) throws Exception {
|
|
|
|
|
|
ApiStatisticsResultStore.store(apiResultRdd, "trace_api_analyze_minutes");
|
|
|
ApiStatisticsResultStore.store(apiResultRdd, "trace_api_analyze_minutes_wn");
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -279,9 +280,25 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { |
|
|
List<SpanInfo> sortSpanList = sortTrace.getSortSpanList();
|
|
|
for (SpanInfo spanInfo : sortSpanList) {
|
|
|
|
|
|
String ip = "";
|
|
|
//只有root和resttemplate才会生成ip
|
|
|
if(spanInfo.getTraceid().equals(spanInfo.getSpanid())){
|
|
|
ip = spanInfo.getIp();
|
|
|
}else{
|
|
|
if(spanInfo.getTags()!=null){
|
|
|
String httpHost = spanInfo.getTags().get("http.host");
|
|
|
if(StringUtils.isNoneBlank(httpHost)){
|
|
|
ip = httpHost;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isBlank(ip)){
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
SpanIpResult spanIpResult = new SpanIpResult();
|
|
|
String spanName = spanInfo.getName();
|
|
|
String ip = spanInfo.getIp();
|
|
|
long duration = spanInfo.getEnd() - spanInfo.getBegin();
|
|
|
spanIpResult.setAvgDuration(duration);
|
|
|
spanIpResult.setIp(ip);
|
...
|
...
|
|