java.lang.Object
java.lang.Record
org.elasticsearch.action.datastreams.lifecycle.ErrorEntry
All Implemented Interfaces:
Comparable<ErrorEntry>, Writeable, ToXContent, ToXContentObject

public record ErrorEntry(long firstOccurrenceTimestamp, String error, long recordedTimestamp, int retryCount) extends Record implements Writeable, ToXContentObject, Comparable<ErrorEntry>
Represents the recorded error for an index that Data Stream Lifecycle Service encountered.
  • Field Details

    • FIRST_OCCURRENCE_FIELD

      public static final ParseField FIRST_OCCURRENCE_FIELD
    • FIRST_OCCURRENCE_MILLIS_FIELD

      public static final ParseField FIRST_OCCURRENCE_MILLIS_FIELD
    • MESSAGE_FIELD

      public static final ParseField MESSAGE_FIELD
    • LAST_RECORDED_MILLIS_FIELD

      public static final ParseField LAST_RECORDED_MILLIS_FIELD
    • LAST_RECORDED_FIELD

      public static final ParseField LAST_RECORDED_FIELD
    • RETRY_COUNT_FIELD

      public static final ParseField RETRY_COUNT_FIELD
  • Constructor Details

    • ErrorEntry

      public ErrorEntry(StreamInput in) throws IOException
      Throws:
      IOException
    • ErrorEntry

      public ErrorEntry(long firstOccurrenceTimestamp, String error, long recordedTimestamp, int retryCount)
      Creates an instance of a ErrorEntry record class.
      Parameters:
      firstOccurrenceTimestamp - the value for the firstOccurrenceTimestamp record component
      error - the value for the error record component
      recordedTimestamp - the value for the recordedTimestamp record component
      retryCount - the value for the retryCount record component
  • Method Details

    • incrementRetryCount

      public static ErrorEntry incrementRetryCount(ErrorEntry existingRecord, LongSupplier nowSupplier)
      Creates a new ErrorEntry with the same first occurent timestamp and error message as the provided existing record, but with a fresh timestamp for the latest occurrence and an incremented retry count.
    • toXContent

      public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface ToXContent
      Throws:
      IOException
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • compareTo

      public int compareTo(ErrorEntry o)
      Compares two error entries by the number of retries, in reversed order by default.
      Specified by:
      compareTo in interface Comparable<ErrorEntry>
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • firstOccurrenceTimestamp

      public long firstOccurrenceTimestamp()
      Returns the value of the firstOccurrenceTimestamp record component.
      Returns:
      the value of the firstOccurrenceTimestamp record component
    • error

      public String error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • recordedTimestamp

      public long recordedTimestamp()
      Returns the value of the recordedTimestamp record component.
      Returns:
      the value of the recordedTimestamp record component
    • retryCount

      public int retryCount()
      Returns the value of the retryCount record component.
      Returns:
      the value of the retryCount record component