Class MeteredResolver

java.lang.Object
com.tnsai.resilience.MeteredResolver

public final class MeteredResolver extends Object
Resolves the @Metered annotation on an action method or its declaring Role class and produces a MeteredHandle to wrap the dispatch. Issue #173, Phase 1.

Resolution order: method-level wins over class-level (matching the convention every other Phase-1 resolver uses — guardrails, retrieval, tool bindings). Both absent → returns MeteredHandle.NOOP so the caller's try/finally shape never branches.

Since:
0.5.4 (issue #173, Phase 1)
  • Method Details

    • start

      public static MeteredHandle start(ActionMetadata action, Role role)
      Opens a metered span for the given action invocation. The returned handle records exactly one entry to ResilienceMetrics when MeteredHandle.close() runs.
      Parameters:
      action - the action being dispatched (carries the method handle)
      role - the role hosting the action (for class-level fallback)
      Returns:
      a handle to record the outcome on, or MeteredHandle.NOOP when neither method nor class declares @Metered