make http_sd_registry optional

This commit is contained in:
Barbara Miller 2024-09-12 13:11:41 -07:00
parent 1d84e72ce7
commit c82858a9f6

View file

@ -1,6 +1,6 @@
from typing import Optional
"""
try:
from http_sd_registry.client import (
Client,
Env,
@ -9,7 +9,9 @@ from http_sd_registry.client import (
format_self_target,
)
from http_sd_registry.config import ClientConfig
"""
except ImportError:
http_sd_registry = None
from prometheus_client import Counter, Gauge, Histogram, start_http_server
# fmt: off
@ -27,7 +29,7 @@ brozzler_ydl_download_attempts= Counter("brozzler_ydl_download_attempts", "count
brozzler_ydl_download_successes= Counter("brozzler_ydl_download_successes", "count of downloads completed by brozzler yt-dlp", labelnames=["host"])
# fmt: on
if http_sd_registry:
def register_prom_metrics(
registry_url: Optional[str] = None, metrics_port: int = 8888, env: Env = Env.qa
):