Search in sources :

Example 1 with CollectDataFrame

use of com.creditease.agent.apm.api.CollectDataFrame in project uavstack by uavorg.

the class CopyOfProcessOfLogagent method sendLogDataBatch.

@SuppressWarnings("unchecked")
protected void sendLogDataBatch(Map<TailFile, List<Map>> serverlogs) {
    DataCollector dc = (DataCollector) ConfigurationManager.getInstance().getComponent("collectclient", DataCollector.class.getName());
    for (Entry<TailFile, List<Map>> en : serverlogs.entrySet()) {
        TailFile tf = en.getKey();
        List<Map> data = en.getValue();
        CollectDataFrame frame = new CollectDataFrame(tf.getServerId(), tf.getAppId(), tf.getPath());
        // 给日志设置应用组
        frame.setAppgroup(System.getProperty("JAppGroup"));
        for (Map<String, String> m : data) {
            frame.append(Integer.parseInt(m.get("_lnum")), m.get("content"), Long.parseLong(m.get("_timestamp")));
        }
        dc.submit(frame);
    }
}
Also used : CollectDataFrame(com.creditease.agent.apm.api.CollectDataFrame) List(java.util.List) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) DataCollector(com.creditease.uav.collect.client.collectdata.DataCollector) ImmutableMap(com.google.common.collect.ImmutableMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 2 with CollectDataFrame

use of com.creditease.agent.apm.api.CollectDataFrame in project uavstack by uavorg.

the class DefaultGatherDataHandler method handle.

@Override
public void handle(Message msg) {
    String jsonarr = msg.getParam(msg.getMessageType());
    List<CollectDataFrame> frames = JSONHelper.toObjectArray(jsonarr, CollectDataFrame.class);
    Set<AbstractCollectDataHandler> handlers = ConfigurationManager.getInstance().getComponents(AbstractCollectDataHandler.class);
    for (AbstractCollectDataHandler handler : handlers) {
        try {
            if (handler.isHandleable(msg.getMessageType())) {
                handler.handle(frames);
            }
        } catch (Exception e) {
            log.err(this, "gather data handler failed. msgType:" + msg.getMessageType() + ", handler: " + handler.getName(), e);
        }
    }
}
Also used : AbstractCollectDataHandler(com.creditease.agent.apm.api.AbstractCollectDataHandler) CollectDataFrame(com.creditease.agent.apm.api.CollectDataFrame)

Aggregations

CollectDataFrame (com.creditease.agent.apm.api.CollectDataFrame)2 AbstractCollectDataHandler (com.creditease.agent.apm.api.AbstractCollectDataHandler)1 DataCollector (com.creditease.uav.collect.client.collectdata.DataCollector)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1