Implement RecorderPolicy and Integrate with Resilience Chain
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
## Motivation
Resilience operations need to automatically record their outcomes to the RequestRecorder. A new policy in the resilience chain can transparently capture this information.
- No automatic recording of resilience operation results
- Manual recording would require changes to every decorated method
## Required Features
- Create `RecorderPolicy` class extending base `Policy`
- Record operation name, success/failure status, duration, and error message
- Gracefully handle case when no recorder context is active (skip recording)
- Add RecorderPolicy to existing client resilience configurations
- Position in chain: typically after MetricPolicy, before RetryPolicy
## Impact
- New file: `src/ai/backend/common/resilience/policies/recorder.py`
- `src/ai/backend/common/resilience/policies/__init__.py`
- `src/ai/backend/manager/clients/agent/client.py`
- `src/ai/backend/manager/clients/storage_proxy/manager_facing_client.py`
- `src/ai/backend/manager/clients/appproxy/client.py`
## Testing Scenarios
- Test RecorderPolicy records success with duration
- Test RecorderPolicy records failure with error message
- Test policy works correctly without active recorder context
- Integration test with full resilience chain
JIRA Issue: BA-3729
Contributor guide
Assessment
This issue has not been assessed yet.