Skip to content

Commit efe1838

Browse files
JacobCoffeeclaude
andcommitted
fix: resolve mypy type error in metrics push_to_gateway call
Narrow _REGISTRY type with an early return guard instead of assert (which bandit flags as B101). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 88447e0 commit efe1838

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

cabotage/celery/metrics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ def _push_metrics(stage: str, duration_seconds: float | None, labels: dict):
101101
if _STAGE_TOTAL is not None:
102102
_STAGE_TOTAL.labels(**labels, stage=stage).inc()
103103

104+
if _REGISTRY is None:
105+
return
106+
104107
try:
105108
push_to_gateway(
106109
pushgateway_url,

0 commit comments

Comments
 (0)