Interface MetricsRecorder

All Known Implementing Classes:
LazyMetricsRecorder, MicrometerMetricsRecorder, NoOpMetricsRecorder

public interface MetricsRecorder
Output port responsible for recording invocation metrics: how many times a method was called, how long calls took, and how many of them failed.

Unlike InvocationEventEmitter, which is subject to sampling and threshold rules, implementations of this port are expected to record every single invocation, since metrics back dashboards and alerts that depend on complete data rather than a sampled view.

This interface belongs to the framework-free core module and has no knowledge of any specific metrics backend (for example Micrometer). Adapter modules provide the real implementation. A no-op implementation is provided in this module so that the core can be used standalone, without any metrics backend, without throwing an exception.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    record(String className, String methodName, long durationNanos, boolean success, String exceptionType)
    Records the outcome and duration of a single method invocation.
  • Method Details

    • record

      void record(String className, String methodName, long durationNanos, boolean success, String exceptionType)
      Records the outcome and duration of a single method invocation.
      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