Class LossReport

java.lang.Object
io.aeron.driver.reports.LossReport

public final class LossReport extends Object
A report of loss events on a message stream.

The provided AtomicBuffer can wrap a memory-mapped file so logging can be out of process. This provides the benefit that if a crash or lockup occurs then the log can be read externally without loss of data.

Note:This class is NOT threadsafe to be used from multiple logging threads.

The error records are recorded to the memory mapped buffer in the following format.

   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |R|                    Observation Count                        |
  |                                                               |
  +-+-------------------------------------------------------------+
  |R|                     Total Bytes Lost                        |
  |                                                               |
  +---------------------------------------------------------------+
  |                 First Observation Timestamp                   |
  |                                                               |
  +---------------------------------------------------------------+
  |                  Last Observation Timestamp                   |
  |                                                               |
  +---------------------------------------------------------------+
  |                          Session ID                           |
  +---------------------------------------------------------------+
  |                           Stream ID                           |
  +---------------------------------------------------------------+
  |                 Channel encoded in US-ASCII                  ...
 ...                                                              |
  +---------------------------------------------------------------+
  |                  Source encoded in US-ASCII                  ...
 ...                                                              |
  +---------------------------------------------------------------+
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Report entry for a specific stream.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Offset within an entry at which the channel field begins.
    static final int
    Alignment to be applied for each entry offset.
    static final int
    Offset within an entry at which the first observation field begins.
    static final int
    Offset within an entry at which the last observation field begins.
    static final int
    Offset within an entry at which the observation count begins.
    static final int
    Offset within an entry at which the session id field begins.
    static final int
    Offset within an entry at which the stream id field begins.
    static final int
    Offset within an entry at which the total bytes field begins.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a loss report which wraps a buffer which is ideally memory mapped, so it can be read from another process.
  • Method Summary

    Modifier and Type
    Method
    Description
    createEntry(long initialBytesLost, long timestampMs, int sessionId, int streamId, String channel, String source)
    Create a new entry for recording loss on a given stream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • ENTRY_ALIGNMENT

      public static final int ENTRY_ALIGNMENT
      Alignment to be applied for each entry offset.
      See Also:
    • OBSERVATION_COUNT_OFFSET

      public static final int OBSERVATION_COUNT_OFFSET
      Offset within an entry at which the observation count begins.
      See Also:
    • TOTAL_BYTES_LOST_OFFSET

      public static final int TOTAL_BYTES_LOST_OFFSET
      Offset within an entry at which the total bytes field begins.
      See Also:
    • FIRST_OBSERVATION_OFFSET

      public static final int FIRST_OBSERVATION_OFFSET
      Offset within an entry at which the first observation field begins.
      See Also:
    • LAST_OBSERVATION_OFFSET

      public static final int LAST_OBSERVATION_OFFSET
      Offset within an entry at which the last observation field begins.
      See Also:
    • SESSION_ID_OFFSET

      public static final int SESSION_ID_OFFSET
      Offset within an entry at which the session id field begins.
      See Also:
    • STREAM_ID_OFFSET

      public static final int STREAM_ID_OFFSET
      Offset within an entry at which the stream id field begins.
      See Also:
    • CHANNEL_OFFSET

      public static final int CHANNEL_OFFSET
      Offset within an entry at which the channel field begins.
      See Also:
  • Constructor Details

    • LossReport

      public LossReport(AtomicBuffer buffer)
      Create a loss report which wraps a buffer which is ideally memory mapped, so it can be read from another process.
      Parameters:
      buffer - to be wrapped.
  • Method Details

    • createEntry

      public LossReport.ReportEntry createEntry(long initialBytesLost, long timestampMs, int sessionId, int streamId, String channel, String source)
      Create a new entry for recording loss on a given stream.

      If not space is remaining in the error report then null is returned.

      Parameters:
      initialBytesLost - on the stream.
      timestampMs - at which the first loss was observed.
      sessionId - for the stream.
      streamId - for the stream.
      channel - for the stream.
      source - of the stream.
      Returns:
      a new record or null if the error log has insufficient space.
    • toString

      public String toString()
      Overrides:
      toString in class Object