Class 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 through newMetricConsumer(), and to inspect the current accumulated state of metrics through snapshot.
    Author:
    Simon Thoresen Hult
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  StateMonitor.Status  
    • Field Summary

      • Fields inherited from class com.yahoo.component.AbstractComponent

        isDeconstructable
    • 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 this
      com.yahoo.jdisc.application.MetricConsumer newMetricConsumer()
      Returns a metric consumer for jDisc which will write metrics back to this
      MetricSnapshot snapshot()
      Returns the last snapshot taken of the metrics in this system
      StateMonitor.Status status()  
      void status​(StateMonitor.Status status)  
      • Methods inherited from class com.yahoo.component.AbstractComponent

        clone, compareTo, getClassName, getId, getIdString, hasInitializedId, initId, isDeconstructable, setIsDeconstructable, toString
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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
      • 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 class com.yahoo.component.AbstractComponent