SIENTIAPDE-1083: add env HTTP_SERVER_PORT for prometheus metrics.

This commit is contained in:
Bruno Domingues
2025-05-30 12:30:51 -03:00
parent 36d12bdda8
commit d7ba8a4ab4
2 changed files with 7 additions and 4 deletions

View File

@@ -58,8 +58,9 @@ def signal_handler(_signum, _frame):
def start_prometheus_server():
try:
start_http_server(8000)
print("Prometheus server started on port 8000.")
port = int(os.getenv("HTTP_SERVER_PORT", 4840))
start_http_server(port)
print(f"Prometheus server started on port {port}.")
metrics.APP_UP.labels(pod_id=POD_ID).set(1) # Mark app as UP
except Exception as e:
print(f"Failed to start Prometheus server: {e}")