This commit is contained in:
parent
6e3123091a
commit
aeddaa6972
69 changed files with 3178 additions and 424 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Roll up and optionally prune persisted admin health samples."""
|
||||
"""저장된 관리자 헬스 표본을 집계하고 보존 기간이 지난 행을 정리한다."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
@ -24,12 +24,18 @@ if hasattr(sys.stderr, "reconfigure"):
|
|||
def build_parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(
|
||||
description=(
|
||||
"Roll up app.admin_health_event into app.admin_health_daily_rollup "
|
||||
"and optionally prune old raw samples."
|
||||
"app.admin_health_event를 app.admin_health_daily_rollup으로 집계하고 "
|
||||
"보존 기간이 지난 raw 표본을 필요할 때 정리한다."
|
||||
)
|
||||
)
|
||||
parser.add_argument("--rollup-days", type=int, required=True, help="Roll up raw samples older than this many days.")
|
||||
parser.add_argument("--retention-days", type=int, required=True, help="Prune raw samples older than this many days.")
|
||||
parser.add_argument("--rollup-days", type=int, required=True, help="이 일수보다 오래된 raw 표본을 집계한다.")
|
||||
parser.add_argument("--retention-days", type=int, default=90, help="이 일수보다 오래된 raw 표본을 삭제한다. 기본값은 90일이다.")
|
||||
parser.add_argument(
|
||||
"--rollup-retention-days",
|
||||
type=int,
|
||||
default=365,
|
||||
help="이 일수보다 오래된 일별 rollup을 삭제한다. 기본값은 365일이다.",
|
||||
)
|
||||
parser.add_argument("--apply", action="store_true", help="Mutate the database. Default is dry-run.")
|
||||
parser.add_argument(
|
||||
"--allow-non-dev-apply",
|
||||
|
|
@ -63,6 +69,7 @@ async def _run(args: argparse.Namespace) -> dict[str, object]:
|
|||
result = await maintain_admin_health_events(
|
||||
rollup_days=args.rollup_days,
|
||||
retention_days=args.retention_days,
|
||||
rollup_retention_days=args.rollup_retention_days,
|
||||
apply=args.apply,
|
||||
)
|
||||
finally:
|
||||
|
|
@ -78,7 +85,10 @@ def _print_result(result: dict[str, object], *, as_json: bool) -> None:
|
|||
print(
|
||||
"{mode}: rollup_events={rollup_event_count}, rollup_buckets={rollup_bucket_count}, "
|
||||
"upserted_rollups={upserted_rollups}, prunable_events={prunable_event_count}, "
|
||||
"deleted_events={deleted_events}".format(mode=mode, **result)
|
||||
"deleted_events={deleted_events}, rollup_retention_days={rollup_retention_days}, "
|
||||
"prunable_rollups={prunable_rollup_count}, deleted_rollups={deleted_rollups}".format(
|
||||
mode=mode, **result
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue