Class 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 class GrpcLogger extends PrometheusLogger
Class for Recoding/Printing benchmark results on micrometer Composite Meter Registry.
  • 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)
      Description copied from interface: Logger
      Default implementation for setting exception handler. if the logger encounters any exception, it can report to SBK.
      Parameters:
      handler - Exception handler
    • 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 PrometheusLogger
      Parameters:
      params - InputOptions object to be extended.
      Throws:
      IllegalArgumentException - If an exception occurred.
    • parseArgs

      public void parseArgs(ParsedOptions params) throws IllegalArgumentException
      Parse SBM options and decide if gRPC export is enabled.
      Specified by:
      parseArgs in interface Logger
      Overrides:
      parseArgs in class PrometheusLogger
      Parameters:
      params - ParsedOptions containing driver/logger specific parameters/arguments.
      Throws:
      IllegalArgumentException - If an exception occurred.
    • 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 PrometheusLogger
      Parameters:
      params - ParsedOptions including logger-specific configuration.
      storageName - The Name of the storage.
      action - action to print
      time - time interface
      Throws:
      IOException - If an exception occurred.
      IllegalArgumentException
    • 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 PrometheusLogger
      Parameters:
      params - ParsedOptions used during open; may carry shutdown options.
      Throws:
      IOException - If an exception occurred.
      IllegalArgumentException
    • sendLatenciesRecord

      public void sendLatenciesRecord()
      Send the accumulated request/latency counters to SBM and reset local accumulators.
    • recordWriteRequests

      public void recordWriteRequests(int writerId, long startTime, long bytes, long events)
      Record write requests locally and mirror them into RAM buffers for gRPC export when enabled.
      Specified by:
      recordWriteRequests in interface RWLogger
      Specified by:
      recordWriteRequests in interface WriteRequestsLogger
      Overrides:
      recordWriteRequests in class AbstractRWLogger
      Parameters:
      writerId - logical writer identifier (0..N-1)
      startTime - write start time in the active TimeUnit
      bytes - bytes written for these events
      events - number of write events
    • recordReadRequests

      public void recordReadRequests(int readerId, long startTime, long bytes, long events)
      Record read requests locally and mirror them into RAM buffers for gRPC export when enabled.
      Specified by:
      recordReadRequests in interface ReadRequestsLogger
      Specified by:
      recordReadRequests in interface RWLogger
      Overrides:
      recordReadRequests in class AbstractRWLogger
      Parameters:
      readerId - logical reader identifier (0..N-1)
      startTime - read start time in the active TimeUnit
      bytes - bytes read for these events
      events - number of read events
    • recordWriteTimeoutEvents

      public void recordWriteTimeoutEvents(int readerId, long startTime, long events)
      Record write timeout events and mirror them into RAM buffers for gRPC export when enabled.
      Specified by:
      recordWriteTimeoutEvents in interface WriteRequestsLogger
      Overrides:
      recordWriteTimeoutEvents in class AbstractRWLogger
      Parameters:
      readerId - logical writer identifier (0..N-1)
      startTime - time when timeouts were observed
      events - number of timeout events
    • recordReadTimeoutEvents

      public void recordReadTimeoutEvents(int writerId, long startTime, long events)
      Record read timeout events and mirror them into RAM buffers for gRPC export when enabled.
      Specified by:
      recordReadTimeoutEvents in interface ReadRequestsLogger
      Overrides:
      recordReadTimeoutEvents in class AbstractRWLogger
      Parameters:
      writerId - logical reader identifier (0..N-1)
      startTime - time when timeouts were observed
      events - number of timeout events
    • 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.
    • print

      public 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)
      Description copied from class: SystemLogger
      Print the periodic results to System.out at the end of each interval.
      Specified by:
      print in interface RWPrint
      Overrides:
      print in class PrometheusLogger
      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