lablup / lablup/backend.ai

Add phase_history Column to Audit Log Table

Open
#7,759 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Motivation

Audit logs currently do not capture the execution phases and steps that occurred during an operation. Adding phase history enables detailed debugging and analysis of complex operations.

- Cannot see what steps were executed during an audited operation
- No visibility into which phase failed when errors occur

## Required Features

- Create Alembic migration to add `phase_history` column to `audit_logs` table
- Column type: `JSONB` (PostgreSQL) for flexible schema
- Column should be nullable
- Update AuditLogRow model to include phase_history field
- Modify audit log creation to store RequestRecorder results as phase_history

## Impact

- `src/ai/backend/manager/models/audit_log/row.py`
- New Alembic migration file
- `src/ai/backend/manager/actions/monitors/audit_log.py`

## Testing Scenarios

- Verify migration runs successfully (upgrade and downgrade)
- Verify phase_history is stored correctly as JSONB
- Verify audit log creation includes recorder data
- Test querying audit logs with phase_history filter

JIRA Issue: BA-3731

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.