Search in sources :

Example 1 with ServerVendor

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);
}
Also used : ServerVendor(com.creditease.monitor.UAVServer.ServerVendor)

Example 2 with ServerVendor

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();
}
Also used : DPMethod(com.creditease.uav.monitorframework.dproxy.bytecode.DPMethod) ServerVendor(com.creditease.monitor.UAVServer.ServerVendor) DynamicProxyProcessor(com.creditease.uav.monitorframework.dproxy.DynamicProxyProcessor)

Example 3 with ServerVendor

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());
}
Also used : MethodSpanInvokeChainHandler(com.creditease.uav.apm.invokechain.handlers.MethodSpanInvokeChainHandler) JEEServiceRunGlobalFilterHandler(com.creditease.uav.apm.invokechain.jee.JEEServiceRunGlobalFilterHandler) ServerVendor(com.creditease.monitor.UAVServer.ServerVendor) GlobalFilterDispatchListener(com.creditease.uav.appserver.listeners.GlobalFilterDispatchListener) ServiceSpanInvokeChainHandler(com.creditease.uav.apm.invokechain.handlers.ServiceSpanInvokeChainHandler) ClientSpanInvokeChainHandler(com.creditease.uav.apm.invokechain.handlers.ClientSpanInvokeChainHandler)

Example 4 with ServerVendor

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();
}
Also used : ServerVendor(com.creditease.monitor.UAVServer.ServerVendor) GlobalFilterDispatchListener(com.creditease.uav.appserver.listeners.GlobalFilterDispatchListener)

Example 5 with ServerVendor

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));
    }
}
Also used : GlobalFilterDispatchListener(com.creditease.uav.appserver.listeners.GlobalFilterDispatchListener) ServerVendor(com.creditease.monitor.UAVServer.ServerVendor)

Aggregations

ServerVendor (com.creditease.monitor.UAVServer.ServerVendor)13 GlobalFilterDispatchListener (com.creditease.uav.appserver.listeners.GlobalFilterDispatchListener)5 UAVServer (com.creditease.monitor.UAVServer)2 DynamicProxyProcessor (com.creditease.uav.monitorframework.dproxy.DynamicProxyProcessor)2 DPMethod (com.creditease.uav.monitorframework.dproxy.bytecode.DPMethod)2 HashMap (java.util.HashMap)2 AbsGlobalFilterHandler (com.creditease.monitor.globalfilter.AbsGlobalFilterHandler)1 UAVServerJEEController (com.creditease.monitor.globalfilter.jee.UAVServerJEEController)1 InterceptSupport (com.creditease.monitor.interceptframework.InterceptSupport)1 InterceptContext (com.creditease.monitor.interceptframework.spi.InterceptContext)1 InterceptEventListener (com.creditease.monitor.interceptframework.spi.InterceptEventListener)1 ClientSpanInvokeChainHandler (com.creditease.uav.apm.invokechain.handlers.ClientSpanInvokeChainHandler)1 MethodSpanInvokeChainHandler (com.creditease.uav.apm.invokechain.handlers.MethodSpanInvokeChainHandler)1 ServiceSpanInvokeChainHandler (com.creditease.uav.apm.invokechain.handlers.ServiceSpanInvokeChainHandler)1 JEEServiceRunGlobalFilterHandler (com.creditease.uav.apm.invokechain.jee.JEEServiceRunGlobalFilterHandler)1 JdbcDriverIT (com.creditease.uav.hook.jdbc.interceptors.JdbcDriverIT)1 Profile (com.creditease.uav.profiling.spi.Profile)1 ProfileElementInstance (com.creditease.uav.profiling.spi.ProfileElementInstance)1 FastClasspathScanner (io.github.lukehutch.fastclasspathscanner.FastClasspathScanner)1 IOException (java.io.IOException)1