Class MonitoringHandler


  • public class MonitoringHandler
    extends Object
    Handler to monitor the server state using the Metrics library. The recorded informations are accessible through JMX MBeans.
    Author:
    https://github.com/mcweba [Marc-Andre Weber]
    • Method Detail

      • getMonitoringAddress

        protected String getMonitoringAddress()
        Get the event bus address of the monitoring. Override this method when you want to use a custom monitoring address
        Returns:
        the event bus address of monitoring
      • getRedisquesAddress

        protected String getRedisquesAddress()
        Get the event bus address of redisques. Override this method when you want to use a custom redisques address
        Returns:
        the event bus address of redisques
      • getRequestPerRuleMonitoringPath

        public String getRequestPerRuleMonitoringPath()
      • isRequestPerRuleMonitoringActive

        public boolean isRequestPerRuleMonitoringActive()
      • getRequestPerRuleSampling

        public long getRequestPerRuleSampling()
      • getRequestPerRuleExpiry

        public long getRequestPerRuleExpiry()
      • updateIncomingRequests

        public void updateIncomingRequests​(io.vertx.core.http.HttpServerRequest request)
      • updateRequestPerRuleMonitoring

        public void updateRequestPerRuleMonitoring​(io.vertx.core.http.HttpServerRequest request,
                                                   String metricName)
      • updateRequestsMeter

        public void updateRequestsMeter​(String target,
                                        String uri)
        Update the meter values for requests. Requests from clients and requests to other backends are measured separately.
        Parameters:
        target - the target url of the request
        uri - uri
      • startRequestMetricTracking

        public long startRequestMetricTracking​(String metricName,
                                               String targetUri)
        Start the metric tracking for the requests defined with the metricName (routing rule)
        Parameters:
        metricName - the name of the metric. This name will be used as name of the JMX MBean. metricNames are defined in routing rules with the property "metricName"
        targetUri - targetUri
        Returns:
        long
      • stopRequestMetricTracking

        public void stopRequestMetricTracking​(String metricName,
                                              long startTime,
                                              String targetUri)
        Stop the metric tracking for the requests defined with the metricName (routing rule)
        Parameters:
        metricName - the name of the metric. This name will be used as name of the JMX MBean. metricNames are defined in routing rules with the property "metricName"
        startTime - start time
        targetUri - target uri
      • updateQueueCountInformation

        public void updateQueueCountInformation()
        Update the count of active queues. Reads the count from redis and stores it to JMX.
      • updateLastUsedQueueSizeInformation

        public void updateLastUsedQueueSizeInformation​(String queue)
        Reads the size from the last used Queue from redis and stores it to JMX
        Parameters:
        queue - the name of the queue the last update was made
      • updateQueuesSizesInformation

        public void updateQueuesSizesInformation​(int numQueues,
                                                 boolean showEmptyQueues,
                                                 MonitoringHandler.MonitoringCallback callback)
        Updates the information about the sizes of the top (numQueues) sized queues.
        Parameters:
        numQueues - the number of queues
        showEmptyQueues - show empty queues or not
        callback - the callback returning the result
      • updateEnqueue

        public void updateEnqueue()
      • updateDequeue

        public void updateDequeue()
      • updateListenerCount

        public void updateListenerCount​(long count)
      • updateRoutesCount

        public void updateRoutesCount​(long count)