Package jenkins.metrics.api
Class Metrics
- java.lang.Object
-
- hudson.Plugin
-
- jenkins.metrics.api.Metrics
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Metrics.HealthCheckData
Health check data.static class
Metrics.HealthChecker
Performs the periodic running of health checks and re-indexing of access keys.static class
Metrics.HealthCheckMetricsProvider
provides the health check related metrics.static class
Metrics.HeathCheckMetricsProvider
Deprecated.use HealthCheckMetricsProvider-
Nested classes/interfaces inherited from class hudson.Plugin
Plugin.DummyImpl
-
-
Field Summary
Fields Modifier and Type Field Description static Permission
HEALTH_CHECK
Permission to run healthchecks from the Codahale Metrics Operations Servlet.static int
HEALTH_CHECK_INTERVAL_MINS
The frequency with which to run health checks.static String
JMX_DOMAIN
JMX domainstatic PermissionGroup
PERMISSIONS
Permission group for Metrics related permissions.static Permission
THREAD_DUMP
Permission to get a thread dump from the Codahale Metrics Operations Servlet.static Permission
VIEW
Permission to view the Codahale Metrics Operations Servlet.-
Fields inherited from class hudson.Plugin
SKIP_PERMISSION_CHECK
-
-
Constructor Summary
Constructors Constructor Description Metrics()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
afterExtensionsAugmented()
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
cors(String accessKey, org.kohsuke.stapler.HttpResponse resp)
static Metrics.HealthCheckData
getHealthCheckData()
Get the current health check data.static SortedMap<String,com.codahale.metrics.health.HealthCheck.Result>
getHealthCheckResults()
Get the last health check resultsstatic com.codahale.metrics.health.HealthCheckRegistry
healthCheckRegistry()
Returns theHealthCheckRegistry
for the currentJenkins
.static com.codahale.metrics.MetricRegistry
metricRegistry()
Returns theMetricRegistry
for the currentJenkins
.static void
reindexAccessKeys()
Re-indexes all the access keys from the differentMetricsAccessKey.Provider
extensions.void
start()
void
stop()
-
Methods inherited from class hudson.Plugin
configure, configure, doDynamic, getConfigXml, getTarget, getWrapper, load, postInitialize, save, setServletContext
-
-
-
-
Field Detail
-
HEALTH_CHECK_INTERVAL_MINS
public static final int HEALTH_CHECK_INTERVAL_MINS
The frequency with which to run health checks.
-
PERMISSIONS
public static final PermissionGroup PERMISSIONS
Permission group for Metrics related permissions.
-
VIEW
public static final Permission VIEW
Permission to view the Codahale Metrics Operations Servlet.
-
THREAD_DUMP
public static final Permission THREAD_DUMP
Permission to get a thread dump from the Codahale Metrics Operations Servlet.
-
HEALTH_CHECK
public static final Permission HEALTH_CHECK
Permission to run healthchecks from the Codahale Metrics Operations Servlet.
-
JMX_DOMAIN
public static final String JMX_DOMAIN
JMX domain- See Also:
- Constant Field Values
-
-
Method Detail
-
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
@CheckForNull public static Metrics.HealthCheckData 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
public static void checkAccessKey(@CheckForNull String accessKey)
Checks an access key.- Parameters:
accessKey
- the access key.
-
checkAccessKeyPing
public static void checkAccessKeyPing(@CheckForNull String accessKey)
Checks an access key.- Parameters:
accessKey
- the access key.
-
checkAccessKeyThreadDump
public static void checkAccessKeyThreadDump(@CheckForNull String accessKey)
Checks an access key.- Parameters:
accessKey
- the access key.
-
checkAccessKeyHealthCheck
public static void checkAccessKeyHealthCheck(@CheckForNull String accessKey)
Checks an access key.- Parameters:
accessKey
- the access key.
-
checkAccessKeyMetrics
public static void checkAccessKeyMetrics(@CheckForNull String accessKey)
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.
-
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()
-
-