Class DataStreamLifecycleErrorStore

java.lang.Object
org.elasticsearch.dlm.DataStreamLifecycleErrorStore

public class DataStreamLifecycleErrorStore extends Object
Provides a store for the errors the data stream lifecycle encounters. It offers the functionality to record, retrieve, and clear errors for a specified target. This class is thread safe.
  • Field Details

    • DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING

      public static final Setting<Integer> DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING
      This setting controls how often we signal that an index is in the error state when it comes to its data stream lifecycle progression. The signalling is currently logging at the `error` level but in the future it can signify other types of signalling.
    • MAX_ERROR_MESSAGE_LENGTH

      public static final int MAX_ERROR_MESSAGE_LENGTH
      See Also:
  • Constructor Details

    • DataStreamLifecycleErrorStore

      public DataStreamLifecycleErrorStore(LongSupplier nowSupplier)
  • Method Details

    • recordError

      @Nullable public ErrorEntry recordError(ProjectId projectId, String indexName, Exception e)
      Records a string representation of the provided exception for the provided index. If an error was already recorded for the provided index this will override that error. Returns the previously recorded error for the provided index, or null otherwise.
    • clearRecordedError

      public void clearRecordedError(ProjectId projectId, String indexName)
      Clears the recorded error for the provided index (if any exists)
    • clearStore

      public void clearStore()
      Clears all the errors recorded in the store.
    • getError

      @Nullable public ErrorEntry getError(ProjectId projectId, String indexName)
      Retrieves the recorded error for the provided index.
    • getAllIndices

      public Set<String> getAllIndices(ProjectId projectId)
      Return an immutable view (a snapshot) of the tracked indices at the moment this method is called.
    • getErrorsInfo

      public List<DslErrorInfo> getErrorsInfo(Predicate<ErrorEntry> errorEntryPredicate, int limit)
      Retrieve the error entries in the error store that satisfy the provided predicate. This will return the error entries information (a subset of all the fields an ErrorEntry holds) sorted by the number of retries DSL attempted (descending order) and the number of entries will be limited according to the provided limit parameter. Returns empty list if no entries are present in the error store or none satisfy the predicate.
    • getTotalErrorEntries

      public int getTotalErrorEntries()
      Get the total number of error entries in the store
    • recordAndLogError

      public void recordAndLogError(ProjectId projectId, String targetIndex, Exception e, String logMessage, int signallingErrorRetryThreshold)
      Records the provided error for the index in the error store and logs the error message at `ERROR` level if the error for the index is different to what's already in the error store or if the same error was in the error store for a number of retries divisible by the provided signallingErrorRetryThreshold (i.e. we log to level `error` every signallingErrorRetryThreshold retries, if the error stays the same) This allows us to not spam the logs, but signal to the logs if DSL is not making progress.