Record Class StreamEntry

java.lang.Object
java.lang.Record
codes.grow.packages.loki.StreamEntry
Record Components:
timestampNanos - Unix nanoseconds (lossless)
timestamp - the same time as an Instant
line - the log line
structuredMetadata - structured metadata of the entry (includes Loki's detected_level)
parsed - labels extracted by parser stages (| json, | logfmt, …)

public record StreamEntry(long timestampNanos, Instant timestamp, String line, Map<String,String> structuredMetadata, Map<String,String> parsed) extends Record
One log entry returned by a query or the tail stream.
  • Constructor Details

    • StreamEntry

      public StreamEntry(long timestampNanos, Instant timestamp, String line, Map<String,String> structuredMetadata, Map<String,String> parsed)
      Copies the maps.
      Parameters:
      timestampNanos - Unix nanoseconds
      timestamp - time
      line - line
      structuredMetadata - metadata
      parsed - parsed labels
  • Method Details

    • 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.
    • timestampNanos

      public long timestampNanos()
      Returns the value of the timestampNanos record component.
      Returns:
      the value of the timestampNanos record component
    • 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
    • parsed

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