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
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 -
Method Summary
Modifier and TypeMethodDescriptionfinal void
doRun()
Schedules this periodic work now in a new thread, if one isn't already running.static void
com.codahale.metrics.Gauge<Integer>
Gets theGauge
that tracks the number of health checks.Gets the most recent health check data (which includesMetrics.HealthCheckData.getLastModified()
)com.codahale.metrics.Timer
Gets theTimer
that tracks how long the health checks are taking to execute.Gets the most recent results.com.codahale.metrics.Gauge<Double>
Gets theGauge
that tracks the health check score.long
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
-
Constructor Details
-
HealthChecker
public HealthChecker()Default constructor.
-
-
Method Details
-
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
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
Gets theGauge
that tracks the number of health checks.- Returns:
- the
Gauge
that tracks the number of health checks.
-
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()
-