Package jenkins.metrics.api
Class Metrics
java.lang.Object
hudson.Plugin
jenkins.metrics.api.Metrics
Entry point for all things metrics.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Health check data.static class
Performs the periodic running of health checks and re-indexing of access keys.static class
provides the health check related metrics.static class
Deprecated.use HealthCheckMetricsProviderNested classes/interfaces inherited from class hudson.Plugin
Plugin.DummyImpl
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Permission
Permission to run healthchecks from the Codahale Metrics Operations Servlet.static final int
The frequency with which to run health checks.static final String
JMX domainstatic final PermissionGroup
Permission group for Metrics related permissions.static final Permission
Permission to get a thread dump from the Codahale Metrics Operations Servlet.static final Permission
Permission to view the Codahale Metrics Operations Servlet.Fields inherited from class hudson.Plugin
SKIP_PERMISSION_CHECK
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Initializes all the metrics providers and health check providers.static void
checkAccessKey
(String accessKey) Checks an access key.static void
checkAccessKeyHealthCheck
(String accessKey) Checks an access key.static void
checkAccessKeyMetrics
(String accessKey) Checks an access key.static void
checkAccessKeyPing
(String accessKey) Checks an access key.static void
checkAccessKeyThreadDump
(String accessKey) Checks an access key.static org.kohsuke.stapler.HttpResponse
static Metrics.HealthCheckData
Get the current health check data.Get the last health check resultsstatic com.codahale.metrics.health.HealthCheckRegistry
Returns theHealthCheckRegistry
for the currentJenkins
.static com.codahale.metrics.MetricRegistry
Returns theMetricRegistry
for the currentJenkins
.static void
Re-indexes all the access keys from the differentMetricsAccessKey.Provider
extensions.void
start()
void
stop()
Methods inherited from class hudson.Plugin
configure, configure, configure, doDynamic, doDynamic, getConfigXml, getTarget, getWrapper, load, postInitialize, save, setServletContext
-
Field Details
-
HEALTH_CHECK_INTERVAL_MINS
public static final int HEALTH_CHECK_INTERVAL_MINSThe frequency with which to run health checks. -
PERMISSIONS
Permission group for Metrics related permissions. -
VIEW
Permission to view the Codahale Metrics Operations Servlet. -
THREAD_DUMP
Permission to get a thread dump from the Codahale Metrics Operations Servlet. -
HEALTH_CHECK
Permission to run healthchecks from the Codahale Metrics Operations Servlet. -
JMX_DOMAIN
JMX domain- See Also:
-
-
Constructor Details
-
Metrics
public Metrics()
-
-
Method Details
-
healthCheckRegistry
@NonNull public static com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry()Returns theHealthCheckRegistry
for the currentJenkins
.- Returns:
- the
HealthCheckRegistry
for the currentJenkins
- Throws:
AssertionError
- if there is noJenkins
orMetrics
orHealthCheckRegistry
-
getHealthCheckResults
@NonNull public static SortedMap<String,com.codahale.metrics.health.HealthCheck.Result> getHealthCheckResults()Get the last health check results- Returns:
- a map with health check name -> health check result
-
getHealthCheckData
Get the current health check data.- Returns:
- the current health check data or
null
if the health checks have not run yet.
-
metricRegistry
@NonNull public static com.codahale.metrics.MetricRegistry metricRegistry()Returns theMetricRegistry
for the currentJenkins
.- Returns:
- the
MetricRegistry
for the currentJenkins
- Throws:
AssertionError
- if there is noJenkins
orMetrics
orMetricRegistry
-
checkAccessKey
Checks an access key.- Parameters:
accessKey
- the access key.
-
checkAccessKeyPing
Checks an access key.- Parameters:
accessKey
- the access key.
-
checkAccessKeyThreadDump
Checks an access key.- Parameters:
accessKey
- the access key.
-
checkAccessKeyHealthCheck
Checks an access key.- Parameters:
accessKey
- the access key.
-
checkAccessKeyMetrics
Checks an access key.- Parameters:
accessKey
- the access key.
-
cors
public static org.kohsuke.stapler.HttpResponse cors(@CheckForNull String accessKey, org.kohsuke.stapler.HttpResponse resp) -
reindexAccessKeys
public static void reindexAccessKeys()Re-indexes all the access keys from the differentMetricsAccessKey.Provider
extensions. -
start
-
afterExtensionsAugmented
@Initializer(after=EXTENSIONS_AUGMENTED, before=JOB_LOADED) public static void afterExtensionsAugmented()Initializes all the metrics providers and health check providers. Ideally we would like this to be called earlier but there are occasional deadlocks that can arise if we attempt to enumerate the extensions prior toInitMilestone.EXTENSIONS_AUGMENTED
so we had to move this functionality out ofPlugin.postInitialize()
-
stop
-