INNER CODE UNIT · Python
_is_metrics_bind_conflict
Soju06/codex-lb · app/main.py:377
def _is_metrics_bind_conflict(exc: BaseException) -> bool:
if isinstance(exc, SystemExit):
return exc.code == 1
if isinstance(exc, OSError):
import errno as _errno
return exc.errno in (_errno.EADDRINUSE, _errno.EADDRNOTAVAIL)
return False
def _is_benign_metrics_bind_failure(exc: BaseException) -> bool:
return MULTIPROCESS_MODE and _is_metrics_bind_conflict(exc)
def _log_non_multiproc_metrics_bind_conflict(port: int) -> None:
logger.error(
"Metrics port %d is already bound by another worker process but PROMETHEUS_MULTIPROC_DIR is not set: "
"/metrics reflects only the winning worker's counters (1/N of traffic). "