|
@@ -88,6 +88,7 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { |
|
@@ -88,6 +88,7 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { |
88
|
spanInfo.setEndpoint(logEvent);
|
88
|
spanInfo.setEndpoint(logEvent);
|
89
|
spanInfo.setIp(spans.getHost().getAddress());
|
89
|
spanInfo.setIp(spans.getHost().getAddress());
|
90
|
spanInfo.setReceive(spans.getReceive());
|
90
|
spanInfo.setReceive(spans.getReceive());
|
|
|
91
|
+ spanInfo.setTags(span.tags());
|
91
|
spanInfoList.add(new Tuple2<>(spanInfo.getTraceid(), spanInfo));
|
92
|
spanInfoList.add(new Tuple2<>(spanInfo.getTraceid(), spanInfo));
|
92
|
}
|
93
|
}
|
93
|
}
|
94
|
}
|
|
@@ -256,7 +257,7 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { |
|
@@ -256,7 +257,7 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { |
256
|
@Override
|
257
|
@Override
|
257
|
public void call(JavaPairRDD<String, ApiTraceResult> apiResultRdd) throws Exception {
|
258
|
public void call(JavaPairRDD<String, ApiTraceResult> apiResultRdd) throws Exception {
|
258
|
|
259
|
|
259
|
- ApiStatisticsResultStore.store(apiResultRdd, "trace_api_analyze_minutes");
|
260
|
+ ApiStatisticsResultStore.store(apiResultRdd, "trace_api_analyze_minutes_wn");
|
260
|
}
|
261
|
}
|
261
|
});
|
262
|
});
|
262
|
|
263
|
|
|
@@ -279,9 +280,25 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { |
|
@@ -279,9 +280,25 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { |
279
|
List<SpanInfo> sortSpanList = sortTrace.getSortSpanList();
|
280
|
List<SpanInfo> sortSpanList = sortTrace.getSortSpanList();
|
280
|
for (SpanInfo spanInfo : sortSpanList) {
|
281
|
for (SpanInfo spanInfo : sortSpanList) {
|
281
|
|
282
|
|
|
|
283
|
+ String ip = "";
|
|
|
284
|
+ //只有root和resttemplate才会生成ip
|
|
|
285
|
+ if(spanInfo.getTraceid().equals(spanInfo.getSpanid())){
|
|
|
286
|
+ ip = spanInfo.getIp();
|
|
|
287
|
+ }else{
|
|
|
288
|
+ if(spanInfo.getTags()!=null){
|
|
|
289
|
+ String httpHost = spanInfo.getTags().get("http.host");
|
|
|
290
|
+ if(StringUtils.isNoneBlank(httpHost)){
|
|
|
291
|
+ ip = httpHost;
|
|
|
292
|
+ }
|
|
|
293
|
+ }
|
|
|
294
|
+ }
|
|
|
295
|
+
|
|
|
296
|
+ if(StringUtils.isBlank(ip)){
|
|
|
297
|
+ continue;
|
|
|
298
|
+ }
|
|
|
299
|
+
|
282
|
SpanIpResult spanIpResult = new SpanIpResult();
|
300
|
SpanIpResult spanIpResult = new SpanIpResult();
|
283
|
String spanName = spanInfo.getName();
|
301
|
String spanName = spanInfo.getName();
|
284
|
- String ip = spanInfo.getIp();
|
|
|
285
|
long duration = spanInfo.getEnd() - spanInfo.getBegin();
|
302
|
long duration = spanInfo.getEnd() - spanInfo.getBegin();
|
286
|
spanIpResult.setAvgDuration(duration);
|
303
|
spanIpResult.setAvgDuration(duration);
|
287
|
spanIpResult.setIp(ip);
|
304
|
spanIpResult.setIp(ip);
|