Package jenkins.metrics.api
Class Metrics.HealthChecker
- java.lang.Object
-
- java.util.TimerTask
-
- hudson.triggers.SafeTimerTask
-
- hudson.model.PeriodicWork
-
- jenkins.metrics.api.Metrics.HealthChecker
-
- All Implemented Interfaces:
ExtensionPoint
,Runnable
- Enclosing class:
- Metrics
@Extension public static class Metrics.HealthChecker extends PeriodicWork
Performs the periodic running of health checks and re-indexing of access keys.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.triggers.SafeTimerTask
SafeTimerTask.ExceptionRunnable
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from class hudson.model.PeriodicWork
DAY, HOUR, logger, MIN
-
-
Constructor Summary
Constructors Constructor Description HealthChecker()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doRun()
Schedules this periodic work now in a new thread, if one isn't already running.static void
dynamicInstallHack()
com.codahale.metrics.Gauge<Integer>
getHealthCheckCount()
Gets theGauge
that tracks the number of health checks.Metrics.HealthCheckData
getHealthCheckData()
Gets the most recent health check data (which includesMetrics.HealthCheckData.getLastModified()
)com.codahale.metrics.Timer
getHealthCheckDuration()
Gets theTimer
that tracks how long the health checks are taking to execute.SortedMap<String,com.codahale.metrics.health.HealthCheck.Result>
getHealthCheckResults()
Gets the most recent results.com.codahale.metrics.Gauge<Double>
getHealthCheckScore()
Gets theGauge
that tracks the health check score.long
getRecurrencePeriod()
-
Methods inherited from class hudson.model.PeriodicWork
all, getInitialDelay, init
-
Methods inherited from class hudson.triggers.SafeTimerTask
getLogsRoot, of, run
-
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
-
-
-
Method Detail
-
getRecurrencePeriod
public long getRecurrencePeriod()
- Specified by:
getRecurrencePeriod
in classPeriodicWork
-
getHealthCheckDuration
public com.codahale.metrics.Timer getHealthCheckDuration()
Gets theTimer
that tracks how long the health checks are taking to execute.- Returns:
- the
Timer
that tracks how long the health checks are taking to execute.
-
getHealthCheckResults
@NonNull @WithBridgeMethods(java.util.Map.class) public SortedMap<String,com.codahale.metrics.health.HealthCheck.Result> getHealthCheckResults()
Gets the most recent results.- Returns:
- the most recent results.
- See Also:
getHealthCheckData()
-
getHealthCheckData
@CheckForNull public Metrics.HealthCheckData getHealthCheckData()
Gets the most recent health check data (which includesMetrics.HealthCheckData.getLastModified()
)- Returns:
- the most recent health check data or
null
if the health checks have not run yet.
-
getHealthCheckCount
public com.codahale.metrics.Gauge<Integer> getHealthCheckCount()
Gets theGauge
that tracks the number of health checks.- Returns:
- the
Gauge
that tracks the number of health checks.
-
getHealthCheckScore
public com.codahale.metrics.Gauge<Double> getHealthCheckScore()
Gets theGauge
that tracks the health check score.- Returns:
- the
Gauge
that tracks the health check score.
-
doRun
public final void doRun()
Schedules this periodic work now in a new thread, if one isn't already running. Copy and paste from AsyncPeriodicWork- Specified by:
doRun
in classSafeTimerTask
-
dynamicInstallHack
@Initializer(after=EXTENSIONS_AUGMENTED) @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public static void dynamicInstallHack()
-
-