Record Class LokiEntry

java.lang.Object
java.lang.Record
codes.grow.packages.loki.LokiEntry
Record Components:
timestamp - entry time (nanosecond precision is kept); null means "now" at push time
line - the log line
structuredMetadata - per-entry metadata (string → string, stored but not indexed)

public record LokiEntry(Instant timestamp, String line, Map<String,String> structuredMetadata) extends Record
One log line of a LokiStream.
  • Constructor Details

    • LokiEntry

      public LokiEntry(Instant timestamp, String line, Map<String,String> structuredMetadata)
      Validates and copies the fields.
      Parameters:
      timestamp - entry time or null
      line - the log line
      structuredMetadata - metadata or null
  • Method Details

    • of

      public static LokiEntry of(String line)
      An entry stamped "now" at push time.
      Parameters:
      line - the log line
      Returns:
      the entry
    • of

      public static LokiEntry of(Instant timestamp, String line)
      An entry with a timestamp.
      Parameters:
      timestamp - entry time
      line - the log line
      Returns:
      the entry
    • of

      public static LokiEntry of(Instant timestamp, String line, Map<String,String> structuredMetadata)
      An entry with a timestamp and structured metadata.
      Parameters:
      timestamp - entry time
      line - the log line
      structuredMetadata - metadata
      Returns:
      the entry
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • line

      public String line()
      Returns the value of the line record component.
      Returns:
      the value of the line record component
    • structuredMetadata

      public Map<String,String> structuredMetadata()
      Returns the value of the structuredMetadata record component.
      Returns:
      the value of the structuredMetadata record component