use of com.creditease.monitor.UAVServer.ServerVendor in project uavstack by uavorg.
the class DefaultMonitorSupporter method start.
@Override
public void start() {
ServerVendor vendor = (ServerVendor) this.getServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR);
defaultMonitor = MonitorFactory.instance().buildDefaultMonitor(null);
/**
* System,URL,Application's RespTime & LoadCounter
*/
defaultMonitor.getRepository().addElement(CaptureConstants.MOELEM_SERVER_RESPTIME_SYSTEM, CaptureConstants.CAPPOINT_SERVER_CONNECTOR, "com.creditease.monitor.handlers.ServerEndRespTimeCapHandler");
defaultMonitor.getRepository().addElement(CaptureConstants.MOELEM_SERVER_RESPTIME_APP, CaptureConstants.CAPPOINT_SERVER_CONNECTOR, "com.creditease.monitor.handlers.ServerEndRespTimeCapHandler");
defaultMonitor.getRepository().addElement(CaptureConstants.MOELEM_SERVER_RESPTIME_URL, CaptureConstants.CAPPOINT_SERVER_CONNECTOR, "com.creditease.monitor.handlers.ServerEndRespTimeCapHandler");
/**
* for Tomcat need TomcatSessionCapHandler
*/
if (vendor == ServerVendor.TOMCAT || vendor == ServerVendor.SPRINGBOOT) {
// MonitorElement[] appMoElem = defaultMonitor.getRepository().getElementByMoElemIdAndCapId(
// CaptureConstants.MOELEM_SERVER_RESPTIME_APP, CaptureConstants.CAPPOINT_SERVER_CONNECTOR);
// appMoElem[0].setCapClass("com.creditease.tomcat.plus.handlers.TomcatSessionCapHandler");
}
/**
* JVM state
*/
defaultMonitor.getRepository().addElement(CaptureConstants.MOELEM_JVMSTATE, CaptureConstants.CAPPOINT_MONITOR_DATAOBSERVER, "com.creditease.monitor.handlers.JVMStateCapHandler");
/**
* install monitor to dataobserver
*/
DataObserver.instance().installMonitor(defaultMonitor);
// bind default monitor to server capture endpoint
MonitorFactory.instance().bindMonitorToServerCapPoint(CaptureConstants.CAPPOINT_SERVER_CONNECTOR, defaultMonitor, CapturePhase.PRECAP);
MonitorFactory.instance().bindMonitorToServerCapPoint(CaptureConstants.CAPPOINT_SERVER_CONNECTOR, defaultMonitor, CapturePhase.DOCAP);
}
use of com.creditease.monitor.UAVServer.ServerVendor in project uavstack by uavorg.
the class LogBackHookProxy method InsertIntercept.
private void InsertIntercept(HookContext context, ClassLoader webapploader) {
if (isHookEventDone("insertLogbackIntercepter")) {
return;
}
ServerVendor vendor = (ServerVendor) UAVServer.instance().getServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR);
if (vendor == ServerVendor.SPRINGBOOT) {
return;
}
/**
* set the webapploader is the target classloader
*/
dpInstall.setTargetClassLoader(webapploader);
// 定义一个类里面的hook变量并初始化,防止每次拦截write时都初始化对象
dpInstall.defineField("uavLogHook", LogIT.class, "ch.qos.logback.core.encoder.LayoutWrappingEncoder", "new LogIT()");
dpInstall.installProxy("ch.qos.logback.core.encoder.LayoutWrappingEncoder", new String[] { "com.creditease.uav.log.hook.interceptors" }, new DynamicProxyProcessor() {
@Override
public void process(DPMethod m) throws Exception {
if ("convertToBytes".equals(m.getName())) {
m.insertBefore("{$1=uavLogHook.formatLog($1);}");
}
}
}, false);
// release loader
dpInstall.releaseTargetClassLoader();
}
use of com.creditease.monitor.UAVServer.ServerVendor in project uavstack by uavorg.
the class InvokeChainSupporter method start.
@Override
public void start() {
// init the simple invokechain dataloggermgr
dlm = this.newDataLoggerManager("ivc", "com.creditease.uav.invokechain");
/**
* NOTE: when start the invokechain, we have to clean all ivc logs & lock files
*/
dlm.clearLogs();
ServerVendor vendor = (ServerVendor) UAVServer.instance().getServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR);
// MSCP
if (vendor == ServerVendor.MSCP) {
// TODO
} else // JEE
{
// register ServiceStartInvokeChainHandler to GlobalFilter
GlobalFilterDispatchListener listener = (GlobalFilterDispatchListener) InterceptSupport.instance().getEventListener(GlobalFilterDispatchListener.class);
listener.registerHandler(new JEEServiceRunGlobalFilterHandler("JEEServiceRunGlobalFilterHandler"));
}
// register ServiceEndInvokeChainHandler
handlerMap.put(InvokeChainConstants.CHAIN_APP_SERVICE, new ServiceSpanInvokeChainHandler());
// register ClientSpanInvokeChainHandler
handlerMap.put(InvokeChainConstants.CHAIN_APP_CLIENT, new ClientSpanInvokeChainHandler());
// register MethodSpanInvokeChainHandler
handlerMap.put(InvokeChainConstants.CHAIN_APP_METHOD, new MethodSpanInvokeChainHandler());
}
use of com.creditease.monitor.UAVServer.ServerVendor in project uavstack by uavorg.
the class InvokeChainSupporter method stop.
@Override
public void stop() {
ServerVendor vendor = (ServerVendor) UAVServer.instance().getServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR);
// MSCP
if (vendor == ServerVendor.MSCP) {
// TODO
} else // JEE
{
GlobalFilterDispatchListener listener = (GlobalFilterDispatchListener) InterceptSupport.instance().getEventListener(GlobalFilterDispatchListener.class);
listener.unregisterHandler("JEEServiceRunGlobalFilterHandler");
}
dlm.destroy();
adapterMap.clear();
handlerMap.clear();
super.stop();
}
use of com.creditease.monitor.UAVServer.ServerVendor in project uavstack by uavorg.
the class HttpDataObserverWorker method start.
@Override
public void start() {
GlobalFilterDispatchListener listener = (GlobalFilterDispatchListener) InterceptSupport.instance().getEventListener(GlobalFilterDispatchListener.class);
// register Observer to GlobalFilterDispatchListener
ServerVendor sv = (ServerVendor) UAVServer.instance().getServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR);
/**
* MSCP
*/
if (sv == ServerVendor.MSCP) {
// TODO
} else /**
* JEE
*/
{
listener.registerHandler(new HttpJEEJVMObserver("HttpJEEJVMObserver"));
listener.registerHandler(new HttpJEEMonitorObserver("HttpJEEMonitorObserver", this));
listener.registerHandler(new HttpJEEProfileObserver("HttpJEEProfileObserver", this));
}
}
Aggregations