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 TypeClassDescriptionclass
Web binding for the access keysclass
Web binding for the current user.class
A binding of the standard dropwizard metrics servlet into the stapler APIstatic class
Sampler 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.HttpResponse
doHealthcheck
(org.kohsuke.stapler.StaplerRequest2 req, String key) Binds the health checks to the CORS aware URL/metrics/healthcheck
where the metrics access key is provided in the form fieldkey
or anAuthorization: Jenkins-Metrics-Key {key}
headerorg.kohsuke.stapler.HttpResponse
doHealthcheckOk
(org.kohsuke.stapler.StaplerRequest2 req) Condense the health check into one bit of information for frontend reverse proxies like haproxy.org.kohsuke.stapler.HttpResponse
Binds the metrics to the CORS aware URL/metrics/metrics
where the metrics access key is provided in the form fieldkey
or anAuthorization: Jenkins-Metrics-Key {key}
headerorg.kohsuke.stapler.HttpResponse
doMetricsHistory
(org.kohsuke.stapler.StaplerRequest2 req, String key) Binds the metrics history to the CORS aware URL/metrics/metricsHistory
where the metrics access key is provided in the form fieldkey
or anAuthorization: Jenkins-Metrics-Key {key}
headerorg.kohsuke.stapler.HttpResponse
Binds the ping check to the CORS aware URL/metrics/ping
where the metrics access key is provided in the form fieldkey
or anAuthorization: Jenkins-Metrics-Key {key}
headerorg.kohsuke.stapler.HttpResponse
Binds the thread dump to the CORS aware URL/metrics/threads
where the metrics access key is provided in the form fieldkey
or anAuthorization: Jenkins-Metrics-Key {key}
headerBinds theMetricsRootAction.Pseudoservlet
for the current user to the URL/metrics/currentUser
getDynamic
(String key) Binds theMetricsRootAction.Pseudoservlet
for 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:
getIconFileName
in interfaceAction
-
getDisplayName
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
- Specified by:
getUrlName
in interfaceAction
-
getDynamic
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Object getDynamic(String key) Binds theMetricsRootAction.Pseudoservlet
for a metric access keys to the URL/metrics/{key}
- Parameters:
key
- the key.- Returns:
- the
MetricsRootAction.Pseudoservlet
-
getCurrentUser
Binds theMetricsRootAction.Pseudoservlet
for 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/healthcheck
where the metrics access key is provided in the form fieldkey
or 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/metrics
where the metrics access key is provided in the form fieldkey
or 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/metricsHistory
where the metrics access key is provided in the form fieldkey
or 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/ping
where the metrics access key is provided in the form fieldkey
or 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/threads
where the metrics access key is provided in the form fieldkey
or 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.
-