Authored by wangning

update

@@ -32,5 +32,5 @@ public class SpanInfo implements Serializable { @@ -32,5 +32,5 @@ public class SpanInfo implements Serializable {
32 */ 32 */
33 private String pageId; 33 private String pageId;
34 34
35 - private Map<String, String> tags; 35 + private String httpHost;
36 } 36 }
@@ -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