chore(docker): the history move logs which services its old keys belong to (#6718)
#6718 "A swarm container's metrics, normal and anomalies are keyed by its task name, so they start over whenever the task moves". The move found 391,091 hourly-only task names against 51 services and about 400 keys with raw samples. Log the services with the most keys and a few names, to read before those keys start moving. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import logging
|
||||
import time
|
||||
from collections import Counter
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import delete, select, text, update
|
||||
@@ -90,6 +91,9 @@ async def old_keys(session) -> list[str]:
|
||||
| await names(MaintenanceWindow.scope_resource, MaintenanceWindow.scope_source == "docker"))
|
||||
logger.info("Swarm history under task names: %d keys with raw samples, %d with hourly rows, "
|
||||
"%d named by anomalies, rules or windows", len(recent), len(hourly), len(named))
|
||||
by_service = Counter(task_service(k.split("/", 1)[1]) for k in hourly - recent)
|
||||
logger.info("Swarm history under task names, hourly only, most keys first: %s; for example %s",
|
||||
by_service.most_common(10), sorted(hourly - recent)[:3])
|
||||
return sorted(hourly - recent) + sorted((named - hourly) - recent) + sorted(recent)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user