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);
}
}
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);
}
}
}
Aggregations