feat(legacy-meter): schedule 8h capture activity on railiance01
Add legacy-meter-8h-capture cron (0 */8 * * * UTC), pass hours through the state-hub resolver, and label progress summaries by window size.
This commit is contained in:
parent
b59bf92341
commit
f41cf14977
5 changed files with 104 additions and 2 deletions
|
|
@ -178,15 +178,24 @@ def _legacy_meter_weekly_review(params: dict[str, Any]) -> dict[str, Any]:
|
|||
"""Fetch State Hub legacy-meter weekly review for activity-core scheduling."""
|
||||
query_params = {
|
||||
key: params[key]
|
||||
for key in ("days", "window_start", "window_end")
|
||||
for key in ("days", "hours", "window_start", "window_end")
|
||||
if key in params
|
||||
}
|
||||
raw = _fetch_json("/legacy-meter/weekly-review", query_params or None)
|
||||
interfaces = raw.get("interfaces") or []
|
||||
candidates = raw.get("retirement_candidates") or []
|
||||
window_calls = sum(int((item.get("window") or {}).get("calls") or 0) for item in interfaces)
|
||||
window_hours = params.get("hours")
|
||||
window_days = params.get("days")
|
||||
if window_hours is not None:
|
||||
window_label = f"{window_hours}h"
|
||||
elif window_days is not None:
|
||||
window_label = f"{window_days}d"
|
||||
else:
|
||||
window_label = "7d"
|
||||
return {
|
||||
"kind": "legacy_meter_weekly_review",
|
||||
"window_label": window_label,
|
||||
"generated_at": raw.get("generated_at"),
|
||||
"window_start": raw.get("window_start"),
|
||||
"window_end": raw.get("window_end"),
|
||||
|
|
|
|||
|
|
@ -538,8 +538,9 @@ def _legacy_meter_summary_text(result: dict[str, Any]) -> str:
|
|||
candidates = result.get("retirement_candidate_count", 0)
|
||||
calls = result.get("window_legacy_calls", 0)
|
||||
interfaces = result.get("interface_count", 0)
|
||||
window_label = result.get("window_label", "7d")
|
||||
return (
|
||||
f"Legacy-meter weekly review: {candidates} retirement candidate(s) of "
|
||||
f"Legacy-meter {window_label} review: {candidates} retirement candidate(s) of "
|
||||
f"{interfaces} registered interface(s); {calls} legacy call(s) in window"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue