From ad9a87ff610af1ecf7a5adda88d95e0369dea4e5 Mon Sep 17 00:00:00 2001 From: 3un01a <3un01a@plasticlabs.ai> Date: Thu, 18 Jun 2026 10:26:59 -0700 Subject: [PATCH] fix: make deriver metrics port configurable via DERIVER_METRICS_PORT env var The deriver hardcodes port 9090 for its Prometheus metrics server, which conflicts with production Prometheus instances on the same host. This makes the port configurable via the DERIVER_METRICS_PORT env var, defaulting to 9090 for backward compatibility. --- src/deriver/__main__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/deriver/__main__.py b/src/deriver/__main__.py index c56ed6a0..ac52eed9 100644 --- a/src/deriver/__main__.py +++ b/src/deriver/__main__.py @@ -20,12 +20,13 @@ logger = logging.getLogger(__name__) def start_metrics_server() -> None: - """Start the Prometheus metrics HTTP server on port 9090.""" - start_http_server(9090) + """Start the Prometheus metrics HTTP server.""" + metrics_port = int(os.getenv("DERIVER_METRICS_PORT", "9090")) + start_http_server(metrics_port) # Expose DB connection-pool stats for this deriver instance. register_db_pool_collector("deriver") register_db_query_instrumentation("deriver") - logger.info("Prometheus metrics server started on port 9090") + logger.info(f"Prometheus metrics server started on port {metrics_port}") def setup_logging():