Class GrpcLogger

java.lang.Object
io.perl.logger.impl.ResultsLogger
io.sbk.logger.impl.AbstractRWLogger
io.sbk.logger.impl.GrpcLogger
All Implemented Interfaces:
io.perl.logger.PerformanceLogger, io.perl.logger.Print, io.perl.logger.ReportLatency, CountReaders, CountRW, CountWriters, Logger, ReadRequestsLogger, RWLogger, RWPrint, SetRW, WriteRequestsLogger

public final class GrpcLogger extends AbstractRWLogger
Streams exact SBK latency frequencies and request counters to an SBM aggregator.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a gRPC logger.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add SBM host/port options and load defaults from sbmhost.properties.
    void
    Close the logger, unregister the client, and shutdown the gRPC channel.
    protected String
    getTimeStamp(long reportTime)
    Formats a report timestamp in the local time zone.
    void
    open(ParsedOptions params, String storageName, Action action, io.time.Time time)
    Open the logger, establish a gRPC channel, validate configuration with SBM, and prepare buffers.
    void
    Parse and validate the required SBM endpoint options.
    final void
    print(int writers, int maxWriters, int readers, int maxReaders, long writeRequestBytes, double writeRequestMbPerSec, long writeRequestRecords, double writeRequestRecordsPerSec, long readRequestBytes, double readRequestMbPerSec, long readRequestRecords, double readRequestRecordsPerSec, long writeResponsePendingRecords, long writeResponsePendingBytes, long readResponsePendingRecords, long readResponsePendingBytes, long writeReadRequestPendingRecords, long writeReadRequestPendingBytes, long writeTimeoutEvents, double writeTimeoutEventsPerSec, long readTimeoutEvents, double readTimeoutEventsPerSec, double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts)
    Print the periodic results to System.out at the end of each interval.
    void
    print(long reportTime, int writers, int maxWriters, int readers, int maxReaders, long writeRequestBytes, double writeRequestMbPerSec, long writeRequestRecords, double writeRequestRecordsPerSec, long readRequestBytes, double readRequestMbPerSec, long readRequestRecords, double readRequestRecordsPerSec, long writeResponsePendingRecords, long writeResponsePendingBytes, long readResponsePendingRecords, long readResponsePendingBytes, long writeReadRequestPendingRecords, long writeReadRequestPendingBytes, long writeTimeoutEvents, double writeTimeoutEventsPerSec, long readTimeoutEvents, double readTimeoutEventsPerSec, double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts)
    Print periodic results locally and enqueue the corresponding exact latency batch for SBM.
    final void
    printTotal(int writers, int maxWriters, int readers, int maxReaders, long writeRequestBytes, double writeRequestMbPerSec, long writeRequestRecords, double writeRequestRecordsPerSec, long readRequestBytes, double readRequestsMbPerSec, long readRequestRecords, double readRequestRecordsPerSec, long writeResponsePendingRecords, long writeResponsePendingBytes, long readResponsePendingRecords, long readResponsePendingBytes, long writeReadRequestPendingRecords, long writeReadRequestPendingBytes, long writeTimeoutEvents, double writeTimeoutEventsPerSec, long readTimeoutEvents, double readTimeoutEventsPerSec, double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts)
    Print the final accumulated totals to System.out at the end of the run.
    void
    printTotal(long reportTime, int writers, int maxWriters, int readers, int maxReaders, long writeRequestBytes, double writeRequestMbPerSec, long writeRequestRecords, double writeRequestRecordsPerSec, long readRequestBytes, double readRequestsMbPerSec, long readRequestRecords, double readRequestRecordsPerSec, long writeResponsePendingRecords, long writeResponsePendingBytes, long readResponsePendingRecords, long readResponsePendingBytes, long writeReadRequestPendingRecords, long writeReadRequestPendingBytes, long writeTimeoutEvents, double writeTimeoutEventsPerSec, long readTimeoutEvents, double readTimeoutEventsPerSec, double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts)
    Print the final accumulated totals to System.out at the end of the run.
    void
    recordLatency(long startTime, int events, int bytes, long latency)
    Record individual latency values into the local LatencyRecorder and stage them for gRPC export.
    void
    Sends a terminal SBK failure to SBM before closing the client channel.
    void
    setExceptionHandler(io.perl.exception.ExceptionHandler handler)
    Sets the benchmark exception handler notified when the gRPC transport fails.

    Methods inherited from class io.perl.logger.impl.ResultsLogger

    appendResultString, getMaxLatency, getMinLatency, getPercentileNames, getPercentiles, getPrefix, getTimeUnit, setMaxLatency, setMinLatency, setPercentiles, setPrefix, setTimeUnit

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.perl.logger.PerformanceLogger

    getMaxLatency, getMinLatency, getPercentiles, getTimeUnit
  • Constructor Details

    • GrpcLogger

      public GrpcLogger()
      Construct a gRPC logger. Calls super to initialize base logging and metrics behavior.
  • Method Details

    • setExceptionHandler

      public void setExceptionHandler(io.perl.exception.ExceptionHandler handler)
      Sets the benchmark exception handler notified when the gRPC transport fails.
      Parameters:
      handler - exception handler invoked on transport failure
    • reportFailure

      public void reportFailure(Throwable failure)
      Sends a terminal SBK failure to SBM before closing the client channel.

      The RPC is deliberately outside the latency stream. Failure reporting is best effort so an older SBM that does not implement this RPC cannot mask the original storage or worker exception.

      Parameters:
      failure - terminal benchmark failure
    • addArgs

      public void addArgs(InputOptions params) throws IllegalArgumentException
      Add SBM host/port options and load defaults from sbmhost.properties.
      Specified by:
      addArgs in interface Logger
      Overrides:
      addArgs in class AbstractRWLogger
      Parameters:
      params - command-line option registry
      Throws:
      IllegalArgumentException - if the bundled SBM configuration cannot be loaded
    • parseArgs

      public void parseArgs(ParsedOptions params) throws IllegalArgumentException
      Parse and validate the required SBM endpoint options.
      Specified by:
      parseArgs in interface Logger
      Overrides:
      parseArgs in class AbstractRWLogger
      Parameters:
      params - parsed command-line options
      Throws:
      IllegalArgumentException - if the SBM host is absent or the port is invalid
    • open

      public void open(ParsedOptions params, String storageName, Action action, io.time.Time time) throws IllegalArgumentException, IOException
      Open the logger, establish a gRPC channel, validate configuration with SBM, and prepare buffers.
      Specified by:
      open in interface Logger
      Overrides:
      open in class AbstractRWLogger
      Parameters:
      params - parsed command-line options
      storageName - storage driver name expected by SBM
      action - benchmark action expected by SBM
      time - benchmark time implementation
      Throws:
      IllegalArgumentException - if SBK and SBM configurations are incompatible
      IOException - if the gRPC channel, registration, or stream cannot be initialized
    • close

      public void close(ParsedOptions params) throws IllegalArgumentException, IOException
      Close the logger, unregister the client, and shutdown the gRPC channel.
      Specified by:
      close in interface Logger
      Overrides:
      close in class AbstractRWLogger
      Parameters:
      params - parsed command-line options
      Throws:
      IllegalArgumentException - if inherited logger shutdown validation fails
      IOException - if the stream cannot drain or the channel cannot close cleanly
    • recordLatency

      public void recordLatency(long startTime, int events, int bytes, long latency)
      Record individual latency values into the local LatencyRecorder and stage them for gRPC export.
      Parameters:
      startTime - operation start time
      events - number of operations represented by this measurement
      bytes - number of bytes represented by this measurement
      latency - measured operation latency
    • print

      public void print(long reportTime, int writers, int maxWriters, int readers, int maxReaders, long writeRequestBytes, double writeRequestMbPerSec, long writeRequestRecords, double writeRequestRecordsPerSec, long readRequestBytes, double readRequestMbPerSec, long readRequestRecords, double readRequestRecordsPerSec, long writeResponsePendingRecords, long writeResponsePendingBytes, long readResponsePendingRecords, long readResponsePendingBytes, long writeReadRequestPendingRecords, long writeReadRequestPendingBytes, long writeTimeoutEvents, double writeTimeoutEventsPerSec, long readTimeoutEvents, double readTimeoutEventsPerSec, double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts)
      Print periodic results locally and enqueue the corresponding exact latency batch for SBM.
      Parameters:
      reportTime - report time in milliseconds
      writers - active writers
      maxWriters - maximum writers
      readers - active readers
      maxReaders - maximum readers
      writeRequestBytes - write request bytes
      writeRequestMbPerSec - write request throughput in MB/sec
      writeRequestRecords - write request records
      writeRequestRecordsPerSec - write requests per second
      readRequestBytes - read request bytes
      readRequestMbPerSec - read request throughput in MB/sec
      readRequestRecords - read request records
      readRequestRecordsPerSec - read requests per second
      writeResponsePendingRecords - pending write response records
      writeResponsePendingBytes - pending write response bytes
      readResponsePendingRecords - pending read response records
      readResponsePendingBytes - pending read response bytes
      writeReadRequestPendingRecords - write-read pending records
      writeReadRequestPendingBytes - write-read pending bytes
      writeTimeoutEvents - write timeout events
      writeTimeoutEventsPerSec - write timeout events per second
      readTimeoutEvents - read timeout events
      readTimeoutEventsPerSec - read timeout events per second
      seconds - reporting interval seconds
      bytes - bytes processed
      records - records processed
      recsPerSec - records per second
      mbPerSec - throughput in MB/sec
      avgLatency - average latency
      minLatency - minimum latency
      maxLatency - maximum latency
      invalid - invalid latency count
      lowerDiscard - latencies discarded below the configured minimum
      higherDiscard - latencies discarded above the configured maximum
      slc1 - sliding latency coverage count 1
      slc2 - sliding latency coverage count 2
      percentileLatencies - percentile latency values
      percentileLatencyCounts - percentile latency bucket counts
    • getTimeStamp

      protected String getTimeStamp(long reportTime)
      Formats a report timestamp in the local time zone.
      Parameters:
      reportTime - epoch-millisecond report time
      Returns:
      formatted timestamp
    • print

      public final void print(int writers, int maxWriters, int readers, int maxReaders, long writeRequestBytes, double writeRequestMbPerSec, long writeRequestRecords, double writeRequestRecordsPerSec, long readRequestBytes, double readRequestMbPerSec, long readRequestRecords, double readRequestRecordsPerSec, long writeResponsePendingRecords, long writeResponsePendingBytes, long readResponsePendingRecords, long readResponsePendingBytes, long writeReadRequestPendingRecords, long writeReadRequestPendingBytes, long writeTimeoutEvents, double writeTimeoutEventsPerSec, long readTimeoutEvents, double readTimeoutEventsPerSec, double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts)
      Print the periodic results to System.out at the end of each interval.
      Specified by:
      print in interface RWPrint
      Overrides:
      print in class AbstractRWLogger
      Parameters:
      writers - number of active writers
      maxWriters - maximum writers seen
      readers - number of active readers
      maxReaders - maximum readers seen
      writeRequestBytes - write request bytes in this interval
      writeRequestMbPerSec - write request throughput in MB/sec
      writeRequestRecords - write request count
      writeRequestRecordsPerSec - write requests per second
      readRequestBytes - read request bytes in this interval
      readRequestMbPerSec - read request throughput in MB/sec
      readRequestRecords - read request count
      readRequestRecordsPerSec - read requests per second
      writeResponsePendingRecords - pending write response records
      writeResponsePendingBytes - pending write response bytes
      readResponsePendingRecords - pending read response records
      readResponsePendingBytes - pending read response bytes
      writeReadRequestPendingRecords - write-read pending records delta
      writeReadRequestPendingBytes - write-read pending bytes delta
      writeTimeoutEvents - write timeout events count
      writeTimeoutEventsPerSec - write timeout events per second
      readTimeoutEvents - read timeout events count
      readTimeoutEventsPerSec - read timeout events per second
      seconds - reporting interval seconds
      bytes - total bytes processed in interval
      records - total records processed in interval
      recsPerSec - records per second
      mbPerSec - MB per second
      avgLatency - average latency
      minLatency - minimum latency
      maxLatency - maximum latency
      invalid - invalid/negative latency count
      lowerDiscard - discarded below min latency
      higherDiscard - discarded above max latency
      slc1 - sliding latency coverage 1
      slc2 - sliding latency coverage 2
      percentileLatencies - percentile latency values
      percentileLatencyCounts - percentile latency counts
    • printTotal

      public final void printTotal(int writers, int maxWriters, int readers, int maxReaders, long writeRequestBytes, double writeRequestMbPerSec, long writeRequestRecords, double writeRequestRecordsPerSec, long readRequestBytes, double readRequestsMbPerSec, long readRequestRecords, double readRequestRecordsPerSec, long writeResponsePendingRecords, long writeResponsePendingBytes, long readResponsePendingRecords, long readResponsePendingBytes, long writeReadRequestPendingRecords, long writeReadRequestPendingBytes, long writeTimeoutEvents, double writeTimeoutEventsPerSec, long readTimeoutEvents, double readTimeoutEventsPerSec, double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts)
      Print the final accumulated totals to System.out at the end of the run.
      Specified by:
      printTotal in interface RWLogger
      Overrides:
      printTotal in class AbstractRWLogger
      Parameters:
      writers - number of active writers
      maxWriters - maximum writers seen
      readers - number of active readers
      maxReaders - maximum readers seen
      writeRequestBytes - write request bytes total
      writeRequestMbPerSec - write request throughput in MB/sec
      writeRequestRecords - write request count total
      writeRequestRecordsPerSec - write requests per second
      readRequestBytes - read request bytes total
      readRequestsMbPerSec - read request throughput in MB/sec
      readRequestRecords - read request count total
      readRequestRecordsPerSec - read requests per second
      writeResponsePendingRecords - pending write response records
      writeResponsePendingBytes - pending write response bytes
      readResponsePendingRecords - pending read response records
      readResponsePendingBytes - pending read response bytes
      writeReadRequestPendingRecords - write-read pending records delta
      writeReadRequestPendingBytes - write-read pending bytes delta
      writeTimeoutEvents - write timeout events count
      writeTimeoutEventsPerSec - write timeout events per second
      readTimeoutEvents - read timeout events count
      readTimeoutEventsPerSec - read timeout events per second
      seconds - reporting seconds
      bytes - total bytes processed
      records - total records processed
      recsPerSec - records per second
      mbPerSec - MB per second
      avgLatency - average latency
      minLatency - minimum latency
      maxLatency - maximum latency
      invalid - invalid/negative latency count
      lowerDiscard - discarded below min latency
      higherDiscard - discarded above max latency
      slc1 - sliding latency coverage 1
      slc2 - sliding latency coverage 2
      percentileLatencies - percentile latency values
      percentileLatencyCounts - percentile latency counts
    • printTotal

      public void printTotal(long reportTime, int writers, int maxWriters, int readers, int maxReaders, long writeRequestBytes, double writeRequestMbPerSec, long writeRequestRecords, double writeRequestRecordsPerSec, long readRequestBytes, double readRequestsMbPerSec, long readRequestRecords, double readRequestRecordsPerSec, long writeResponsePendingRecords, long writeResponsePendingBytes, long readResponsePendingRecords, long readResponsePendingBytes, long writeReadRequestPendingRecords, long writeReadRequestPendingBytes, long writeTimeoutEvents, double writeTimeoutEventsPerSec, long readTimeoutEvents, double readTimeoutEventsPerSec, double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts)
      Print the final accumulated totals to System.out at the end of the run.
      Parameters:
      reportTime - report time in milliseconds
      writers - number of active writers
      maxWriters - maximum writers seen
      readers - number of active readers
      maxReaders - maximum readers seen
      writeRequestBytes - write request bytes total
      writeRequestMbPerSec - write request throughput in MB/sec
      writeRequestRecords - write request count total
      writeRequestRecordsPerSec - write requests per second
      readRequestBytes - read request bytes total
      readRequestsMbPerSec - read request throughput in MB/sec
      readRequestRecords - read request count total
      readRequestRecordsPerSec - read requests per second
      writeResponsePendingRecords - pending write response records
      writeResponsePendingBytes - pending write response bytes
      readResponsePendingRecords - pending read response records
      readResponsePendingBytes - pending read response bytes
      writeReadRequestPendingRecords - write-read pending records delta
      writeReadRequestPendingBytes - write-read pending bytes delta
      writeTimeoutEvents - write timeout events count
      writeTimeoutEventsPerSec - write timeout events per second
      readTimeoutEvents - read timeout events count
      readTimeoutEventsPerSec - read timeout events per second
      seconds - reporting seconds
      bytes - total bytes processed
      records - total records processed
      recsPerSec - records per second
      mbPerSec - MB per second
      avgLatency - average latency
      minLatency - minimum latency
      maxLatency - maximum latency
      invalid - invalid/negative latency count
      lowerDiscard - discarded below min latency
      higherDiscard - discarded above max latency
      slc1 - sliding latency coverage 1
      slc2 - sliding latency coverage 2
      percentileLatencies - percentile latency values
      percentileLatencyCounts - percentile latency counts