feat(log): add independent short retention for performance metrics

性能指标(CPU/内存/磁盘/网络)不再跟随 log_retention_days_*,新增三库共用
的 metric_retention_days 配置(默认 3 天),系统垃圾清理按独立短留存清理
指标快照;访问日志保留时长不变。新增 PG/SQLite 双方言 goose 迁移 seed。
This commit is contained in:
ryan
2026-08-09 09:04:33 +08:00
parent 9df2437e47
commit bd2183c8bb
8 changed files with 154 additions and 12 deletions
@@ -0,0 +1,9 @@
-- +goose Up
-- 性能指标(CPU/内存/磁盘/网络)保留天数:三库共用、独立短留存(默认 3 天),
-- 不随 log_retention_days_*(访问日志保留配置)变化。
INSERT INTO w_system_configs (key, value, type, visibility, description, created_at, updated_at)
VALUES ('metric_retention_days', '3', 'business', 0, '性能指标(CPU/内存/磁盘/网络)保留天数(三库共用)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
ON CONFLICT (key) DO NOTHING;
-- +goose Down
DELETE FROM w_system_configs WHERE key = 'metric_retention_days';
@@ -0,0 +1,8 @@
-- +goose Up
-- 性能指标(CPU/内存/磁盘/网络)保留天数:三库共用、独立短留存(默认 3 天),
-- 不随 log_retention_days_*(访问日志保留配置)变化。
INSERT OR IGNORE INTO w_system_configs (key, value, type, visibility, description, created_at, updated_at)
VALUES ('metric_retention_days', '3', 'business', 0, '性能指标(CPU/内存/磁盘/网络)保留天数(三库共用)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
-- +goose Down
DELETE FROM w_system_configs WHERE key = 'metric_retention_days';