Interface PacketStatsRecorder

All Known Implementing Classes:
PacketStatsRecorderImpl

public interface PacketStatsRecorder
Interface for recording packet statistics at the wire level. Called by PacketIO during frame read/write to capture both uncompressed (serialized) and compressed (wire) sizes.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Per-packet statistics entry.
    static final record 
    Statistics for a recent time window.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final io.netty.util.AttributeKey<PacketStatsRecorder>
    Channel attribute key for accessing the recorder from encoder/decoder.
    static final PacketStatsRecorder
    No-op implementation for when stats recording is not needed.
  • Method Summary

    Modifier and Type
    Method
    Description
    getEntry(int packetId)
    Get the stats entry for a specific packet ID.
    void
    recordReceive(int packetId, int uncompressedSize, int compressedSize)
    Record statistics for an inbound packet.
    void
    recordSend(int packetId, int uncompressedSize, int compressedSize)
    Record statistics for an outbound packet.
  • Field Details

    • CHANNEL_KEY

      static final io.netty.util.AttributeKey<PacketStatsRecorder> CHANNEL_KEY
      Channel attribute key for accessing the recorder from encoder/decoder.
    • NOOP

      static final PacketStatsRecorder NOOP
      No-op implementation for when stats recording is not needed.
  • Method Details

    • recordSend

      void recordSend(int packetId, int uncompressedSize, int compressedSize)
      Record statistics for an outbound packet.
      Parameters:
      packetId - the packet ID
      uncompressedSize - the serialized size before compression
      compressedSize - the wire size after compression (same as uncompressed if not compressed)
    • recordReceive

      void recordReceive(int packetId, int uncompressedSize, int compressedSize)
      Record statistics for an inbound packet.
      Parameters:
      packetId - the packet ID
      uncompressedSize - the decompressed payload size
      compressedSize - the wire size before decompression (same as uncompressed if not compressed)
    • getEntry

      @Nonnull PacketStatsRecorder.PacketStatsEntry getEntry(int packetId)
      Get the stats entry for a specific packet ID.