Package com.tnsai.resilience
Class MeteredResolver
java.lang.Object
com.tnsai.resilience.MeteredResolver
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 Summary
Modifier and TypeMethodDescriptionstatic MeteredHandlestart(ActionMetadata action, Role role) Opens a metered span for the given action invocation.
-
Method Details
-
start
Opens a metered span for the given action invocation. The returned handle records exactly one entry toResilienceMetricswhenMeteredHandle.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.NOOPwhen neither method nor class declares@Metered
-