Search in sources :

Example 1 with RequestProbeProvider

use of org.glassfish.web.admin.monitor.RequestProbeProvider in project Payara by payara.

the class VirtualServer method addProbes.

/**
 * Sets all the monitoring probes used in the virtual server
 *
 * @param globalAccessLoggingEnabled
 * @see org.glassfish.grizzly.http.HttpProbe
 */
void addProbes(boolean globalAccessLoggingEnabled) {
    for (final NetworkListener listener : getGrizzlyNetworkListeners()) {
        try {
            final GrizzlyProxy proxy = (GrizzlyProxy) grizzlyService.lookupNetworkProxy(listener);
            if (proxy != null) {
                GenericGrizzlyListener grizzlyListener = (GenericGrizzlyListener) proxy.getUnderlyingListener();
                List<HttpCodecFilter> codecFilters = grizzlyListener.getFilters(HttpCodecFilter.class);
                if (codecFilters == null || codecFilters.isEmpty()) {
                    // if it's AJP listener - it's ok if we didn't find HttpCodecFilter
                    if (grizzlyListener.isAjpEnabled()) {
                        continue;
                    }
                    _logger.log(Level.SEVERE, LogFacade.CODE_FILTERS_NULL, new Object[] { listener.getName(), codecFilters });
                } else {
                    for (HttpCodecFilter codecFilter : codecFilters) {
                        if (codecFilter.getMonitoringConfig().getProbes().length == 0) {
                            HttpProbeImpl httpProbe = new HttpProbeImpl(listener, isAccessLoggingEnabled(globalAccessLoggingEnabled));
                            codecFilter.getMonitoringConfig().addProbes(httpProbe);
                        }
                    }
                }
                grizzlyListener.getTransport().getConnectionMonitoringConfig().addProbes(new ConnectionProbe.Adapter() {

                    RequestProbeProvider requestProbeProvider = webContainer.getRequestProbeProvider();

                    @Override
                    public void onReadEvent(Connection connection, Buffer data, int size) {
                        if (requestProbeProvider != null) {
                            requestProbeProvider.dataReceivedEvent(size, _id);
                        }
                    }

                    @Override
                    public void onWriteEvent(Connection connection, Buffer data, long size) {
                        if (requestProbeProvider != null) {
                            requestProbeProvider.dataSentEvent(size, _id);
                        }
                    }
                });
            } else {
                // check the listener is enabled before spitting out the SEVERE log
                if (Boolean.parseBoolean(listener.getEnabled())) {
                    _logger.log(Level.SEVERE, LogFacade.PROXY_NULL, new Object[] { listener.getName() });
                }
            }
        } catch (Exception ex) {
            _logger.log(Level.SEVERE, LogFacade.ADD_HTTP_PROBES_ERROR, ex);
        }
    }
}
Also used : Buffer(org.glassfish.grizzly.Buffer) GrizzlyProxy(com.sun.enterprise.v3.services.impl.GrizzlyProxy) GenericGrizzlyListener(org.glassfish.grizzly.config.GenericGrizzlyListener) Connection(org.glassfish.grizzly.Connection) HttpCodecFilter(org.glassfish.grizzly.http.HttpCodecFilter) LifecycleException(org.apache.catalina.LifecycleException) ConfigException(org.glassfish.embeddable.web.ConfigException) IOException(java.io.IOException) GlassFishException(org.glassfish.embeddable.GlassFishException) ConnectionProbe(org.glassfish.grizzly.ConnectionProbe) RequestProbeProvider(org.glassfish.web.admin.monitor.RequestProbeProvider) NetworkListener(org.glassfish.grizzly.config.dom.NetworkListener)

Example 2 with RequestProbeProvider

use of org.glassfish.web.admin.monitor.RequestProbeProvider in project Payara by payara.

the class WebContainer method createProbeProviders.

/**
 * Creates probe providers for Servlet, JSP, Session, and Request/Response related events.
 * <p/>
 * While the Servlet, JSP, and Session related probe providers are shared by all web applications (where every web
 * application qualifies its probe events with its application name), the Request/Response related probe provider is
 * shared by all HTTP listeners.
 */
private void createProbeProviders() {
    webModuleProbeProvider = new WebModuleProbeProvider();
    servletProbeProvider = new ServletProbeProvider();
    jspProbeProvider = new JspProbeProvider();
    sessionProbeProvider = new SessionProbeProvider();
    requestProbeProvider = new RequestProbeProvider();
}
Also used : SessionProbeProvider(org.glassfish.web.admin.monitor.SessionProbeProvider) RequestProbeProvider(org.glassfish.web.admin.monitor.RequestProbeProvider) WebModuleProbeProvider(org.glassfish.web.admin.monitor.WebModuleProbeProvider) ServletProbeProvider(org.glassfish.web.admin.monitor.ServletProbeProvider) JspProbeProvider(org.glassfish.web.admin.monitor.JspProbeProvider)

Aggregations

RequestProbeProvider (org.glassfish.web.admin.monitor.RequestProbeProvider)2 GrizzlyProxy (com.sun.enterprise.v3.services.impl.GrizzlyProxy)1 IOException (java.io.IOException)1 LifecycleException (org.apache.catalina.LifecycleException)1 GlassFishException (org.glassfish.embeddable.GlassFishException)1 ConfigException (org.glassfish.embeddable.web.ConfigException)1 Buffer (org.glassfish.grizzly.Buffer)1 Connection (org.glassfish.grizzly.Connection)1 ConnectionProbe (org.glassfish.grizzly.ConnectionProbe)1 GenericGrizzlyListener (org.glassfish.grizzly.config.GenericGrizzlyListener)1 NetworkListener (org.glassfish.grizzly.config.dom.NetworkListener)1 HttpCodecFilter (org.glassfish.grizzly.http.HttpCodecFilter)1 JspProbeProvider (org.glassfish.web.admin.monitor.JspProbeProvider)1 ServletProbeProvider (org.glassfish.web.admin.monitor.ServletProbeProvider)1 SessionProbeProvider (org.glassfish.web.admin.monitor.SessionProbeProvider)1 WebModuleProbeProvider (org.glassfish.web.admin.monitor.WebModuleProbeProvider)1