Search in sources :

Example 6 with JavaThreadObject

use of com.creditease.uav.threadanalysis.data.JavaThreadObject in project uavstack by uavorg.

the class ThreadAnalysisCollectDataHandler method handle.

/**
 * 数据归集feature消费者消息接收方法
 */
@Override
public void handle(CollectDataFrame frame) {
    if (this.log.isDebugEnable()) {
        this.log.debug(this, frame.toJSONString());
    }
    // 线程分析文件按次生成,一次采集完,应该在一个 CollectDataFrame 中
    if (!frame.isEof()) {
        return;
    }
    /**
     * TODO:pname到底从哪获得呢?
     */
    String pname = "";
    String appgroup = frame.getAppgroup();
    String appUUID = frame.getTarget();
    String[] target = appUUID.split("_");
    // 获取数据归集feature的消费信息,frame为一条消费信息,从fame中获取lines为线程分析文件的消费信息
    List<Line> list = frame.getLines();
    // 调用线程分析文件信息处理方法
    List<JavaThreadObject> result = analyse(list);
    /**
     * add additional information: pname,ipport,pid,appgroup,time,user
     */
    for (JavaThreadObject jto : result) {
        jto.setPname(pname);
        jto.setIpport(target[0]);
        jto.setPid(target[1]);
        jto.setAppgroup(appgroup);
        jto.setTime(Long.parseLong(target[2]));
        jto.setUser(target[3]);
    }
    // 处理数据保存工作
    insertThreadObjectToES(result);
}
Also used : Line(com.creditease.agent.apm.api.CollectDataFrame.Line) JavaThreadObject(com.creditease.uav.threadanalysis.data.JavaThreadObject)

Aggregations

JavaThreadObject (com.creditease.uav.threadanalysis.data.JavaThreadObject)6 Line (com.creditease.agent.apm.api.CollectDataFrame.Line)2 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 BulkRequestBuilder (org.elasticsearch.action.bulk.BulkRequestBuilder)1 BulkResponse (org.elasticsearch.action.bulk.BulkResponse)1 IndexRequestBuilder (org.elasticsearch.action.index.IndexRequestBuilder)1