Package com.fayupable.logged.core.port
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
-
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 methodmethodName- the name of the invoked methoddurationNanos- the wall-clock duration of the invocation, in nanosecondssuccess-trueif the method returned normally,falseif it threw an exceptionexceptionType- the simple class name of the exception thrown by the method, ornullif the call succeeded
-