1.修复编译不通过
This commit is contained in:
parent
24fd3ff1be
commit
ceaf154055
|
|
@ -16,6 +16,8 @@ public class ViewPointFilterFactory {
|
|||
|
||||
private static Map<String, ViewPointFilter> filterType;
|
||||
|
||||
private static Object lock = new Object();
|
||||
|
||||
private ViewPointFilterFactory() {
|
||||
//Non
|
||||
}
|
||||
|
|
@ -55,7 +57,7 @@ public class ViewPointFilterFactory {
|
|||
}
|
||||
}
|
||||
|
||||
filterType = new HashMap<String, ViewPointFilter>();
|
||||
|
||||
String[] type = types.split(",");
|
||||
for (int i = 0; i < type.length; i++) {
|
||||
filterType.put(type[i], filter);
|
||||
|
|
@ -65,7 +67,12 @@ public class ViewPointFilterFactory {
|
|||
|
||||
public static ViewPointFilter getFilter(String type) {
|
||||
if (filterType == null) {
|
||||
initFilterChain();
|
||||
synchronized (lock) {
|
||||
if (filterType == null) {
|
||||
filterType = new HashMap<String, ViewPointFilter>();
|
||||
initFilterChain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ViewPointFilter filter = filterType.get(type);
|
||||
|
|
|
|||
|
|
@ -34,4 +34,16 @@ public class NodeChain {
|
|||
filters.add(new CopyAttrNodeFilter());
|
||||
filters.add(new ViewPointNodeFilter());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Span span = new Span("1.0a2.1452649597690.035d27f.1608.56.1@~ @~0@~" +
|
||||
"http://localhost:8080/skywalking-web/order/save@~1452649597692@~5202@~" +
|
||||
"astraea-PC/192.168.1.102@~0@~ @~W@~true@~ @~1608@~web-application@~6@~A ");
|
||||
NodeChain nodeChain = new NodeChain();
|
||||
CostMap costMap = new CostMap();
|
||||
ChainNode chainNode = new ChainNode();
|
||||
nodeChain.doChain(span, chainNode, costMap);
|
||||
|
||||
System.out.print("xx");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,11 @@ public class CostNodeFilter implements ChainNodeFilter {
|
|||
@Override
|
||||
public void doFilter(Span span, ChainNode node, CostMap costMap, NodeChain chain) {
|
||||
if (span.isReceiver()) {
|
||||
costMap.put(span.getParentLevel() + "." + span.getLevelId() + "-S", node.getCost());
|
||||
costMap.put(span.getParentLevel() + "." + span.getLevelId() + "-S", span.getCost());
|
||||
|
||||
if (isFirstNode(span)) {
|
||||
chain.doChain(span, node, costMap);
|
||||
}
|
||||
} else {
|
||||
if (costMap.exists(span.getParentLevel())) {
|
||||
costMap.put(span.getParentLevel(), costMap.get(span.getParentLevel()) + span.getCost());
|
||||
|
|
@ -20,5 +24,11 @@ public class CostNodeFilter implements ChainNodeFilter {
|
|||
}
|
||||
chain.doChain(span, node, costMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean isFirstNode(Span span) {
|
||||
return span.getParentLevel().length() == 0 && span.getLevelId() == 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.ai.cloud.skywalking.analysis.mapper;
|
||||
|
||||
import com.ai.cloud.skywalking.analysis.filter.NodeChain;
|
||||
import com.ai.cloud.skywalking.analysis.model.ChainInfo;
|
||||
import com.ai.cloud.skywalking.analysis.model.ChainNode;
|
||||
import com.ai.cloud.skywalking.analysis.model.CostMap;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.Span;
|
||||
import org.apache.hadoop.hbase.Cell;
|
||||
|
|
@ -14,8 +16,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CallChainMapper extends TableMapper<Text, ChainInfo> {
|
||||
private Logger logger = LoggerFactory.getLogger(CallChainMapper.class.getName());
|
||||
|
|
@ -23,31 +23,13 @@ public class CallChainMapper extends TableMapper<Text, ChainInfo> {
|
|||
@Override
|
||||
protected void map(ImmutableBytesWritable key, Result value, Context context) throws IOException,
|
||||
InterruptedException {
|
||||
Map<String, Long> costMap = new HashMap<String, Long>();
|
||||
|
||||
CostMap costMap = new CostMap();
|
||||
ChainInfo chainInfo = new ChainInfo();
|
||||
String traceId = key.toString();
|
||||
logger.info("Begin to deal Trace[" + traceId + "]...");
|
||||
|
||||
for (Cell cell : value.rawCells()) {
|
||||
ChainNode node = new ChainNode();
|
||||
Span span = new Span(Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
|
||||
|
||||
node.setLevelId(span.getLevelId());
|
||||
node.setParentLevelId(span.getParentLevel());
|
||||
node.setViewPoint(convertViewPoint(span));
|
||||
node.setCost(span.getCost());
|
||||
node.setCallType(span.getCallType());
|
||||
if (span.isReceiver()) {
|
||||
costMap.put(span.getParentLevel() + "." + span.getLevelId() + "-S", span.getCost());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (costMap.containsKey(span.getParentLevel())) {
|
||||
costMap.put(span.getParentLevel(), costMap.get(span.getParentLevel()).longValue() + span.getCost());
|
||||
} else {
|
||||
costMap.put(span.getParentLevel(), 0L);
|
||||
}
|
||||
|
||||
new NodeChain().doChain(span, node, costMap);
|
||||
chainInfo.getNodes().add(node);
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +48,6 @@ public class CallChainMapper extends TableMapper<Text, ChainInfo> {
|
|||
}
|
||||
}
|
||||
|
||||
//入Mysql库
|
||||
//入HBase库
|
||||
//找到首个Node的MD5
|
||||
//拼接MR任务的Key
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
#
|
||||
D,M=com.ai.cloud.skywalking.analysis.viewpoint.impl.ReplaceIPPortFilter
|
||||
D,M,W=com.ai.cloud.skywalking.analysis.viewpoint.impl.ReplaceIPPortFilter
|
||||
J=com.ai.cloud.skywalking.analysis.viewpoint.impl.AppendBusinessKeyFilter
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.ai.cloud.skywalking.api;
|
||||
|
||||
import com.ai.cloud.skywalking.model.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
|
||||
public interface IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.buriedpoint.type;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.model.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
|
||||
public class DubboBuriedPointType implements IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.buriedpoint.type;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.model.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
|
||||
public class JDBCBuriedPointType implements IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.buriedpoint.type;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.model.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
|
||||
public class SpringBuriedPointType implements IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.buriedpoint.type;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.model.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
|
||||
public class WEBBuriedPointType implements IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ai.cloud.skywalking.model;
|
||||
package com.ai.cloud.skywalking.protocol;
|
||||
|
||||
public enum CallType {
|
||||
|
||||
|
|
@ -48,7 +48,9 @@ public class Span extends SpanData {
|
|||
processNo = fieldValues[12].trim();
|
||||
applicationId = fieldValues[13].trim();
|
||||
userId = fieldValues[14].trim();
|
||||
callType = fieldValues[15].trim();
|
||||
if (fieldValues.length > 14) {
|
||||
callType = fieldValues[15].trim();
|
||||
}
|
||||
this.originData = originData;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,4 +137,8 @@ public abstract class SpanData {
|
|||
public void setCallType(String callType) {
|
||||
this.callType = callType;
|
||||
}
|
||||
|
||||
public String getCallType() {
|
||||
return callType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue