Class NoOpMetricsRecorder

java.lang.Object
com.fayupable.logged.core.port.NoOpMetricsRecorder
All Implemented Interfaces:
MetricsRecorder

public final class NoOpMetricsRecorder extends Object implements MetricsRecorder
A no-op MetricsRecorder that discards every invocation it is asked to record.

This implementation exists so that the core module remains fully usable on its own, without requiring any metrics backend (for example Micrometer through logged-spring) on the classpath. Adapter modules are expected to register their own MetricsRecorder implementation and override this default; this class is the fallback when none is provided.

  • Constructor Details

    • NoOpMetricsRecorder

      public NoOpMetricsRecorder()
  • Method Details

    • record

      public void record(String className, String methodName, long durationNanos, boolean success, String exceptionType)
      Description copied from interface: MetricsRecorder
      Records the outcome and duration of a single method invocation.
      Specified by:
      record in interface MetricsRecorder
      Parameters:
      className - the simple or fully qualified name of the class declaring the invoked method
      methodName - the name of the invoked method
      durationNanos - the wall-clock duration of the invocation, in nanoseconds
      success - true if the method returned normally, false if it threw an exception
      exceptionType - the simple class name of the exception thrown by the method, or null if the call succeeded