Showing
2 changed files
with
7 additions
and
8 deletions
@@ -88,7 +88,9 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { | @@ -88,7 +88,9 @@ 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 | + if(span.tags()!=null){ |
92 | + spanInfo.setHttpHost(span.tags().get("http.host")); | ||
93 | + } | ||
92 | spanInfoList.add(new Tuple2<>(spanInfo.getTraceid(), spanInfo)); | 94 | spanInfoList.add(new Tuple2<>(spanInfo.getTraceid(), spanInfo)); |
93 | } | 95 | } |
94 | } | 96 | } |
@@ -246,7 +248,7 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { | @@ -246,7 +248,7 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { | ||
246 | sortSpanTrace.cache(); | 248 | sortSpanTrace.cache(); |
247 | 249 | ||
248 | //处理span+ip的耗时分布 | 250 | //处理span+ip的耗时分布 |
249 | -// handlerSpanIp(sortSpanTrace); | 251 | + handlerSpanIp(sortSpanTrace); |
250 | 252 | ||
251 | JavaPairDStream<String, ApiTraceResult> apiResultTraceDStream = sortSpanTrace.mapToPair(analyzer.ConvertTraceResultFunc) ; | 253 | JavaPairDStream<String, ApiTraceResult> apiResultTraceDStream = sortSpanTrace.mapToPair(analyzer.ConvertTraceResultFunc) ; |
252 | 254 | ||
@@ -285,11 +287,8 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { | @@ -285,11 +287,8 @@ public class TraceAnalyzeHandler implements TraceHandler, Serializable { | ||
285 | if(spanInfo.getTraceid().equals(spanInfo.getSpanid())){ | 287 | if(spanInfo.getTraceid().equals(spanInfo.getSpanid())){ |
286 | ip = spanInfo.getIp(); | 288 | ip = spanInfo.getIp(); |
287 | }else{ | 289 | }else{ |
288 | - if(spanInfo.getTags()!=null){ | ||
289 | - String httpHost = spanInfo.getTags().get("http.host"); | ||
290 | - if(StringUtils.isNoneBlank(httpHost)){ | ||
291 | - ip = httpHost; | ||
292 | - } | 290 | + if(StringUtils.isNotBlank(spanInfo.getHttpHost())){ |
291 | + ip = spanInfo.getHttpHost(); | ||
293 | } | 292 | } |
294 | } | 293 | } |
295 | 294 |
-
Please register or login to post a comment