Class MetricsRootAction

    • Field Detail

      • RATE_UNIT

        public static final TimeUnit RATE_UNIT
        The time units to express rates in, that is all rates are events per minute.
      • DURATION_UNIT

        public static final TimeUnit DURATION_UNIT
        The time unit to express durations in, that is all durations are in seconds.
    • Constructor Detail

      • MetricsRootAction

        public MetricsRootAction()
    • Method Detail

      • doHealthcheck

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public org.kohsuke.stapler.HttpResponse doHealthcheck​(org.kohsuke.stapler.StaplerRequest req,
                                                              @QueryParameter("key")
                                                              String key)
                                                       throws IllegalAccessException
        Binds the health checks to the CORS aware URL /metrics/healthcheck where the metrics access key is provided in the form field key or an Authorization: Jenkins-Metrics-Key {key} header
        Parameters:
        req - the request
        key - the key from the form field.
        Returns:
        the HttpResponse
        Throws:
        IllegalAccessException - if the access attempt is invalid.
      • doHealthcheckOk

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public org.kohsuke.stapler.HttpResponse doHealthcheckOk​(org.kohsuke.stapler.StaplerRequest req)
        Condense the health check into one bit of information for frontend reverse proxies like haproxy. Other health check calls requires authentication, which is not suitable for the haproxy use. But this endpoint only exposes one bit information, it's deemed OK to be exposed unsecurely. return status 200 if everything is OK, 503 (service unavailable) otherwise
        Parameters:
        req - the request
        Returns:
        the HTTP response
      • doMetrics

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public org.kohsuke.stapler.HttpResponse doMetrics​(org.kohsuke.stapler.StaplerRequest req,
                                                          @QueryParameter("key")
                                                          String key)
                                                   throws IllegalAccessException
        Binds the metrics to the CORS aware URL /metrics/metrics where the metrics access key is provided in the form field key or an Authorization: Jenkins-Metrics-Key {key} header
        Parameters:
        req - the request
        key - the key from the form field.
        Returns:
        the HttpResponse
        Throws:
        IllegalAccessException - if the access attempt is invalid.
      • doMetricsHistory

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public org.kohsuke.stapler.HttpResponse doMetricsHistory​(org.kohsuke.stapler.StaplerRequest req,
                                                                 @QueryParameter("key")
                                                                 String key)
                                                          throws IllegalAccessException
        Binds the metrics history to the CORS aware URL /metrics/metricsHistory where the metrics access key is provided in the form field key or an Authorization: Jenkins-Metrics-Key {key} header
        Parameters:
        req - the request
        key - the key from the form field.
        Returns:
        the HttpResponse
        Throws:
        IllegalAccessException - if the access attempt is invalid.
      • doPing

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public org.kohsuke.stapler.HttpResponse doPing​(org.kohsuke.stapler.StaplerRequest req,
                                                       @QueryParameter("key")
                                                       String key)
                                                throws IllegalAccessException
        Binds the ping check to the CORS aware URL /metrics/ping where the metrics access key is provided in the form field key or an Authorization: Jenkins-Metrics-Key {key} header
        Parameters:
        req - the request
        key - the key from the form field.
        Returns:
        the HttpResponse
        Throws:
        IllegalAccessException - if the access attempt is invalid.
      • doThreads

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public org.kohsuke.stapler.HttpResponse doThreads​(org.kohsuke.stapler.StaplerRequest req,
                                                          @QueryParameter("key")
                                                          String key)
                                                   throws IllegalAccessException
        Binds the thread dump to the CORS aware URL /metrics/threads where the metrics access key is provided in the form field key or an Authorization: Jenkins-Metrics-Key {key} header
        Parameters:
        req - the request
        key - the key from the form field.
        Returns:
        the HttpResponse
        Throws:
        IllegalAccessException - if the access attempt is invalid.