Package jenkins.metrics.api
Class MetricsRootAction
java.lang.Object
jenkins.metrics.api.MetricsRootAction
- All Implemented Interfaces:
ExtensionPoint,Action,ModelObject,RootAction,UnprotectedRootAction
Root action that exposes the metrics via the REST UI.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassWeb binding for the access keysclassWeb binding for the current user.classA binding of the standard dropwizard metrics servlet into the stapler APIstatic classSampler that captures an exponential sample of metrics snapshots.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.kohsuke.stapler.HttpResponsedoHealthcheck(org.kohsuke.stapler.StaplerRequest2 req, String key) Binds the health checks to the CORS aware URL/metrics/healthcheckwhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}headerorg.kohsuke.stapler.HttpResponsedoHealthcheckOk(org.kohsuke.stapler.StaplerRequest2 req) Condense the health check into one bit of information for frontend reverse proxies like haproxy.org.kohsuke.stapler.HttpResponseBinds the metrics to the CORS aware URL/metrics/metricswhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}headerorg.kohsuke.stapler.HttpResponsedoMetricsHistory(org.kohsuke.stapler.StaplerRequest2 req, String key) Binds the metrics history to the CORS aware URL/metrics/metricsHistorywhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}headerorg.kohsuke.stapler.HttpResponseBinds the ping check to the CORS aware URL/metrics/pingwhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}headerorg.kohsuke.stapler.HttpResponseBinds the thread dump to the CORS aware URL/metrics/threadswhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}headerBinds theMetricsRootAction.Pseudoservletfor the current user to the URL/metrics/currentUsergetDynamic(String key) Binds theMetricsRootAction.Pseudoservletfor a metric access keys to the URL/metrics/{key}
-
Field Details
-
RATE_UNIT
The time units to express rates in, that is all rates are events per minute. -
DURATION_UNIT
The time unit to express durations in, that is all durations are in seconds.
-
-
Constructor Details
-
MetricsRootAction
public MetricsRootAction()
-
-
Method Details
-
getIconFileName
- Specified by:
getIconFileNamein interfaceAction
-
getDisplayName
- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject
-
getUrlName
- Specified by:
getUrlNamein interfaceAction
-
getDynamic
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Object getDynamic(String key) Binds theMetricsRootAction.Pseudoservletfor a metric access keys to the URL/metrics/{key}- Parameters:
key- the key.- Returns:
- the
MetricsRootAction.Pseudoservlet
-
getCurrentUser
Binds theMetricsRootAction.Pseudoservletfor the current user to the URL/metrics/currentUser- Returns:
- the
MetricsRootAction.Pseudoservlet
-
doHealthcheck
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public org.kohsuke.stapler.HttpResponse doHealthcheck(org.kohsuke.stapler.StaplerRequest2 req, @QueryParameter("key") String key) throws IllegalAccessException Binds the health checks to the CORS aware URL/metrics/healthcheckwhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}header- Parameters:
req- the requestkey- 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.StaplerRequest2 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.StaplerRequest2 req, @QueryParameter("key") String key) throws IllegalAccessException Binds the metrics to the CORS aware URL/metrics/metricswhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}header- Parameters:
req- the requestkey- 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.StaplerRequest2 req, @QueryParameter("key") String key) throws IllegalAccessException Binds the metrics history to the CORS aware URL/metrics/metricsHistorywhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}header- Parameters:
req- the requestkey- 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.StaplerRequest2 req, @QueryParameter("key") String key) throws IllegalAccessException Binds the ping check to the CORS aware URL/metrics/pingwhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}header- Parameters:
req- the requestkey- 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.StaplerRequest2 req, @QueryParameter("key") String key) throws IllegalAccessException Binds the thread dump to the CORS aware URL/metrics/threadswhere the metrics access key is provided in the form fieldkeyor anAuthorization: Jenkins-Metrics-Key {key}header- Parameters:
req- the requestkey- the key from the form field.- Returns:
- the
HttpResponse - Throws:
IllegalAccessException- if the access attempt is invalid.
-