Package com.yahoo.container.jdisc.state
Class StateMonitor
- java.lang.Object
-
- com.yahoo.component.AbstractComponent
-
- com.yahoo.container.jdisc.state.StateMonitor
-
- All Implemented Interfaces:
com.yahoo.component.Component
,java.lang.Comparable<com.yahoo.component.Component>
public class StateMonitor extends com.yahoo.component.AbstractComponent
A state monitor keeps track of the current health and metrics state of a container. It is used by jDisc to hand out metric update API endpoints to workers throughnewMetricConsumer()
, and to inspect the current accumulated state of metrics throughsnapshot
.- Author:
- Simon Thoresen Hult
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StateMonitor.Status
-
Constructor Summary
Constructors Constructor Description StateMonitor()
For testingStateMonitor(long snapshotIntervalMS, StateMonitor.Status status, com.yahoo.jdisc.Timer timer, java.util.concurrent.ThreadFactory threadFactory)
StateMonitor(HealthMonitorConfig config, com.yahoo.jdisc.Timer timer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deconstruct()
long
getSnapshotIntervalMillis()
Returns the interval between each metrics snapshot used by thiscom.yahoo.jdisc.application.MetricConsumer
newMetricConsumer()
Returns a metric consumer for jDisc which will write metrics back to thisMetricSnapshot
snapshot()
Returns the last snapshot taken of the metrics in this systemStateMonitor.Status
status()
void
status(StateMonitor.Status status)
-
-
-
Constructor Detail
-
StateMonitor
public StateMonitor()
For testing
-
StateMonitor
@Inject public StateMonitor(HealthMonitorConfig config, com.yahoo.jdisc.Timer timer)
-
StateMonitor
public StateMonitor(long snapshotIntervalMS, StateMonitor.Status status, com.yahoo.jdisc.Timer timer, java.util.concurrent.ThreadFactory threadFactory)
-
-
Method Detail
-
newMetricConsumer
public com.yahoo.jdisc.application.MetricConsumer newMetricConsumer()
Returns a metric consumer for jDisc which will write metrics back to this
-
status
public void status(StateMonitor.Status status)
-
status
public StateMonitor.Status status()
-
snapshot
public MetricSnapshot snapshot()
Returns the last snapshot taken of the metrics in this system
-
getSnapshotIntervalMillis
public long getSnapshotIntervalMillis()
Returns the interval between each metrics snapshot used by this
-
deconstruct
public void deconstruct()
- Overrides:
deconstruct
in classcom.yahoo.component.AbstractComponent
-
-