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.
This commit is contained in:
parent
bf494257b8
commit
ad9a87ff61
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Reference in New Issue