feat(retention): every growing table is pruned; the audit log has its own window; charts read the raw window from Settings (#5155)
- prune_by_age(column) registers a time-series column with the hourly cleanup; Traefik (metrics, access summaries, global stats) and UniFi (WAN, client, WLAN, DPI, events, alarms, speedtests) register theirs in setup(). - Alert events join monitor results and Ansible runs on data.retention_days, read from Settings each run; Ansible run log files older than it are deleted. - audit.retention_days (365) keeps the audit log longer, set on Settings > General. - metric_series.points reads metrics.retention.raw_days, so the chart's raw/rollup seam is where the rollup put it (RAW_DAYS removed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,11 @@ def setup(app: "Quart") -> None:
|
||||
global _app
|
||||
_app = app
|
||||
from .models import TraefikMetric, TraefikCert, TraefikGlobalStat, TraefikAccessSummary # noqa: F401
|
||||
from steward.core.cleanup import prune_by_age
|
||||
# Samples older than data.retention_days are pruned by the cleanup (#5155).
|
||||
prune_by_age(TraefikMetric.scraped_at)
|
||||
prune_by_age(TraefikGlobalStat.scraped_at)
|
||||
prune_by_age(TraefikAccessSummary.period_end)
|
||||
|
||||
|
||||
def get_scheduled_tasks() -> list:
|
||||
|
||||
@@ -16,6 +16,14 @@ def setup(app: "Quart") -> None:
|
||||
UnifiDevice, UnifiKnownClient, UnifiEvent, UnifiAlarm,
|
||||
UnifiSpeedtestResult, UnifiNetwork, UnifiPortForward, UnifiFwRule,
|
||||
)
|
||||
from steward.core.cleanup import prune_by_age
|
||||
# Samples and history older than data.retention_days are pruned by the
|
||||
# cleanup (#5155). Devices, known clients and config tables are current state.
|
||||
for column in (UnifiWanStat.scraped_at, UnifiClientSnapshot.scraped_at,
|
||||
UnifiWlanStat.scraped_at, UnifiDpiSnapshot.scraped_at,
|
||||
UnifiEvent.event_time, UnifiAlarm.alarm_time,
|
||||
UnifiSpeedtestResult.run_at):
|
||||
prune_by_age(column)
|
||||
|
||||
|
||||
def get_scheduled_tasks() -> list:
|
||||
|
||||
Reference in New Issue
Block a user