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 classHealth check data.static classPerforms the periodic running of health checks and re-indexing of access keys.static classprovides the health check related metrics.static classDeprecated.use HealthCheckMetricsProviderNested classes/interfaces inherited from class hudson.Plugin
Plugin.DummyImpl -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PermissionPermission to run healthchecks from the Codahale Metrics Operations Servlet.static final intThe frequency with which to run health checks.static final StringJMX domainstatic final PermissionGroupPermission group for Metrics related permissions.static final PermissionPermission to get a thread dump from the Codahale Metrics Operations Servlet.static final PermissionPermission to view the Codahale Metrics Operations Servlet.Fields inherited from class hudson.Plugin
SKIP_PERMISSION_CHECK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidInitializes all the metrics providers and health check providers.static voidcheckAccessKey(String accessKey) Checks an access key.static voidcheckAccessKeyHealthCheck(String accessKey) Checks an access key.static voidcheckAccessKeyMetrics(String accessKey) Checks an access key.static voidcheckAccessKeyPing(String accessKey) Checks an access key.static voidcheckAccessKeyThreadDump(String accessKey) Checks an access key.static org.kohsuke.stapler.HttpResponsestatic Metrics.HealthCheckDataGet the current health check data.Get the last health check resultsstatic com.codahale.metrics.health.HealthCheckRegistryReturns theHealthCheckRegistryfor the currentJenkins.static com.codahale.metrics.MetricRegistryReturns theMetricRegistryfor the currentJenkins.static voidRe-indexes all the access keys from the differentMetricsAccessKey.Providerextensions.voidstart()voidstop()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 theHealthCheckRegistryfor the currentJenkins.- Returns:
- the
HealthCheckRegistryfor the currentJenkins - Throws:
AssertionError- if there is noJenkinsorMetricsorHealthCheckRegistry
-
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
nullif the health checks have not run yet.
-
metricRegistry
@NonNull public static com.codahale.metrics.MetricRegistry metricRegistry()Returns theMetricRegistryfor the currentJenkins.- Returns:
- the
MetricRegistryfor the currentJenkins - Throws:
AssertionError- if there is noJenkinsorMetricsorMetricRegistry
-
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.Providerextensions. -
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_AUGMENTEDso we had to move this functionality out ofPlugin.postInitialize() -
stop
-