Search in sources :

Example 1 with RequestCountHttpHandler

use of org.wildfly.mod_cluster.undertow.metric.RequestCountHttpHandler in project wildfly by wildfly.

the class ModClusterUndertowDeploymentProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    // Add mod_cluster-undertow integration service (jboss.modcluster.undertow) as a web deployment dependency
    deploymentUnit.addToAttachmentList(Attachments.WEB_DEPENDENCIES, UndertowEventHandlerAdapterBuilder.SERVICE_NAME);
    // Request count wrapping
    if (isMetricEnabled(RequestCountLoadMetric.class)) {
        deploymentUnit.addToAttachmentList(UndertowAttachments.UNDERTOW_INITIAL_HANDLER_CHAIN_WRAPPERS, new HandlerWrapper() {

            @Override
            public HttpHandler wrap(final HttpHandler handler) {
                return new RequestCountHttpHandler(handler);
            }
        });
    }
    // Bytes Sent wrapping
    if (isMetricEnabled(SendTrafficLoadMetric.class)) {
        deploymentUnit.addToAttachmentList(UndertowAttachments.UNDERTOW_INITIAL_HANDLER_CHAIN_WRAPPERS, new HandlerWrapper() {

            @Override
            public HttpHandler wrap(final HttpHandler handler) {
                return new BytesSentHttpHandler(handler);
            }
        });
    }
    // Bytes Received wrapping
    if (isMetricEnabled(ReceiveTrafficLoadMetric.class)) {
        deploymentUnit.addToAttachmentList(UndertowAttachments.UNDERTOW_INITIAL_HANDLER_CHAIN_WRAPPERS, new HandlerWrapper() {

            @Override
            public HttpHandler wrap(final HttpHandler handler) {
                return new BytesReceivedHttpHandler(handler);
            }
        });
    }
    // Busyness thread setup actions
    if (isMetricEnabled(BusyConnectorsLoadMetric.class)) {
        deploymentUnit.addToAttachmentList(UndertowAttachments.UNDERTOW_OUTER_HANDLER_CHAIN_WRAPPERS, new HandlerWrapper() {

            @Override
            public HttpHandler wrap(final HttpHandler handler) {
                return new RunningRequestsHttpHandler(handler);
            }
        });
    }
}
Also used : RequestCountHttpHandler(org.wildfly.mod_cluster.undertow.metric.RequestCountHttpHandler) HttpHandler(io.undertow.server.HttpHandler) BytesReceivedHttpHandler(org.wildfly.mod_cluster.undertow.metric.BytesReceivedHttpHandler) BytesSentHttpHandler(org.wildfly.mod_cluster.undertow.metric.BytesSentHttpHandler) RunningRequestsHttpHandler(org.wildfly.mod_cluster.undertow.metric.RunningRequestsHttpHandler) RequestCountHttpHandler(org.wildfly.mod_cluster.undertow.metric.RequestCountHttpHandler) BytesSentHttpHandler(org.wildfly.mod_cluster.undertow.metric.BytesSentHttpHandler) BytesReceivedHttpHandler(org.wildfly.mod_cluster.undertow.metric.BytesReceivedHttpHandler) RunningRequestsHttpHandler(org.wildfly.mod_cluster.undertow.metric.RunningRequestsHttpHandler) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) HandlerWrapper(io.undertow.server.HandlerWrapper)

Aggregations

HandlerWrapper (io.undertow.server.HandlerWrapper)1 HttpHandler (io.undertow.server.HttpHandler)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 BytesReceivedHttpHandler (org.wildfly.mod_cluster.undertow.metric.BytesReceivedHttpHandler)1 BytesSentHttpHandler (org.wildfly.mod_cluster.undertow.metric.BytesSentHttpHandler)1 RequestCountHttpHandler (org.wildfly.mod_cluster.undertow.metric.RequestCountHttpHandler)1 RunningRequestsHttpHandler (org.wildfly.mod_cluster.undertow.metric.RunningRequestsHttpHandler)1