- Prometheus metrics go via pushgateway, as different worker processes might have different registries that are not picked up by Prometheus

This commit is contained in:
Josako
2025-03-25 15:48:00 +01:00
parent b6ee7182de
commit 4ea16521e2
9 changed files with 191 additions and 123 deletions

View File

@@ -0,0 +1,11 @@
from flask import current_app
from prometheus_client import push_to_gateway
def sanitize_label(value):
"""Convert value to valid Prometheus label by removing/replacing invalid chars"""
if value is None:
return ""
# Replace spaces and special chars with underscores
import re
return re.sub(r'[^a-zA-Z0-9_]', '_', str(value))