Class HealthPeriodicLogger

java.lang.Object
org.elasticsearch.health.HealthPeriodicLogger
All Implemented Interfaces:
Closeable, AutoCloseable, ClusterStateListener, SchedulerEngine.Listener

public class HealthPeriodicLogger extends Object implements ClusterStateListener, Closeable, SchedulerEngine.Listener
This class periodically logs the results of the Health API to the standard Elasticsearch server log file.
  • Field Details

    • HEALTH_FIELD_PREFIX

      public static final String HEALTH_FIELD_PREFIX
      See Also:
    • POLL_INTERVAL_SETTING

      public static final Setting<TimeValue> POLL_INTERVAL_SETTING
    • ENABLED_SETTING

      public static final Setting<Boolean> ENABLED_SETTING
    • HEALTH_PERIODIC_LOGGER_JOB_NAME

      protected static final String HEALTH_PERIODIC_LOGGER_JOB_NAME
      Name constant for the job HealthService schedules
      See Also:
  • Constructor Details

    • HealthPeriodicLogger

      public HealthPeriodicLogger(Settings settings, ClusterService clusterService, Client client, HealthService healthService)
      Creates a new HealthPeriodicLogger. This creates a scheduled job using the SchedulerEngine framework and runs it on the current health node.
      Parameters:
      settings - the cluster settings, used to get the interval setting.
      clusterService - the cluster service, used to know when the health node changes.
      client - the client used to call the Health Service.
      healthService - the Health Service, where the actual Health API logic lives.
  • Method Details

    • init

      public void init()
      Initializer method to avoid the publication of a self reference in the constructor.
    • clusterChanged

      public void clusterChanged(ClusterChangedEvent event)
      Description copied from interface: ClusterStateListener
      Called when cluster state changes.

      Cluster states are applied one-by-one which means they can be a performance bottleneck. Implementations of this method should therefore be fast, so please consider forking work into the background rather than doing everything inline.

      Specified by:
      clusterChanged in interface ClusterStateListener
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • triggered

      public void triggered(SchedulerEngine.Event event)
      Specified by:
      triggered in interface SchedulerEngine.Listener