Added Unix socket support for the Prometheus metrics server.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Failing after 5s
CI / Tests (push) Successful in 8s
CI / Type Checking (push) Successful in 10s
CI / Spelling (push) Successful in 5s

This commit is contained in:
2026-06-11 15:07:44 -04:00
parent 7b395e1834
commit 446c0cd9ca
5 changed files with 255 additions and 45 deletions
+4 -3
View File
@@ -36,6 +36,7 @@ from crabstero.metrics import (
ERRORS,
GUILD_COUNT,
INGESTION_ACTIVE,
MetricsAddress,
MetricsServer,
)
from crabstero.tasks.ingestion import ingest_channel
@@ -60,14 +61,14 @@ class Crabstero(commands.Bot):
database_path: str,
*,
ingest_only: bool = False,
metrics_address: tuple[str, int] | None = None,
metrics_address: MetricsAddress | None = None,
) -> None:
"""Configure intents, store configuration, and prepare ingestion state.
:param token: The Discord bot token.
:param database_path: The file path to the SQLite database.
:param ingest_only: When True, the bot only ingests data and never responds.
:param metrics_address: Optional (host, port) for the Prometheus metrics server.
:param metrics_address: Optional address for the Prometheus metrics server.
"""
intents = discord.Intents.default()
intents.guilds = True
@@ -121,7 +122,7 @@ class Crabstero(commands.Bot):
self.ingest_cache.start()
if self._metrics_address is not None:
server = MetricsServer(*self._metrics_address)
server = MetricsServer(self._metrics_address)
await server.start()
self._metrics_server = server