mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-08-09 15:02:28 -04:00
make http_sd_registry optional
This commit is contained in:
parent
1d84e72ce7
commit
c82858a9f6
1 changed files with 29 additions and 27 deletions
|
@ -1,6 +1,6 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
"""
|
try:
|
||||||
from http_sd_registry.client import (
|
from http_sd_registry.client import (
|
||||||
Client,
|
Client,
|
||||||
Env,
|
Env,
|
||||||
|
@ -9,7 +9,9 @@ from http_sd_registry.client import (
|
||||||
format_self_target,
|
format_self_target,
|
||||||
)
|
)
|
||||||
from http_sd_registry.config import ClientConfig
|
from http_sd_registry.config import ClientConfig
|
||||||
"""
|
except ImportError:
|
||||||
|
http_sd_registry = None
|
||||||
|
|
||||||
from prometheus_client import Counter, Gauge, Histogram, start_http_server
|
from prometheus_client import Counter, Gauge, Histogram, start_http_server
|
||||||
|
|
||||||
# fmt: off
|
# 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"])
|
brozzler_ydl_download_successes= Counter("brozzler_ydl_download_successes", "count of downloads completed by brozzler yt-dlp", labelnames=["host"])
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
|
if http_sd_registry:
|
||||||
def register_prom_metrics(
|
def register_prom_metrics(
|
||||||
registry_url: Optional[str] = None, metrics_port: int = 8888, env: Env = Env.qa
|
registry_url: Optional[str] = None, metrics_port: int = 8888, env: Env = Env.qa
|
||||||
):
|
):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue