From 534845d4e3e9f6f24a9392acc7418836abdc6f40 Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 6 Mar 2026 10:31:08 +0100 Subject: [PATCH] feat: add cluster_name and cluster_peer labels to Prometheus metrics Add cluster_name and cluster_peer as external_labels in Prometheus config so metrics sent via remote_write include the same identity labels already used by Alloy for logs. --- docker-compose.yml | 2 ++ prometheus/prometheus.yml.example | 2 ++ prometheus/run.sh | 2 ++ 3 files changed, 6 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 69e8f6d5..535b3629 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -177,6 +177,8 @@ services: environment: PROM_REMOTE_WRITE_TOKEN: ${PROM_REMOTE_WRITE_TOKEN} SERVICE_OWNER: ${SERVICE_OWNER:-"obol-cdvn"} + CLUSTER_NAME: ${CLUSTER_NAME:-} + CLUSTER_PEER: ${CLUSTER_PEER:-} volumes: - ./prometheus:/etc/prometheus - ./data/prometheus:/prometheus diff --git a/prometheus/prometheus.yml.example b/prometheus/prometheus.yml.example index 0b8a70b5..4bf16314 100644 --- a/prometheus/prometheus.yml.example +++ b/prometheus/prometheus.yml.example @@ -3,6 +3,8 @@ global: evaluation_interval: 30s # Evaluate rules every 30 seconds. external_labels: service_owner: $SERVICE_OWNER # replace this with your Operator name you want to be identified by, it helps us route alerts and metrics to your notification channels easily + cluster_name: $CLUSTER_NAME + cluster_peer: $CLUSTER_PEER remote_write: - url: https://vm.monitoring.gcp.obol.tech/write diff --git a/prometheus/run.sh b/prometheus/run.sh index 000941ba..f068b99e 100755 --- a/prometheus/run.sh +++ b/prometheus/run.sh @@ -14,6 +14,8 @@ fi sed -e "s|\$PROM_REMOTE_WRITE_TOKEN|${PROM_REMOTE_WRITE_TOKEN}|g" \ -e "s|\$SERVICE_OWNER|${SERVICE_OWNER}|g" \ + -e "s|\$CLUSTER_NAME|${CLUSTER_NAME}|g" \ + -e "s|\$CLUSTER_PEER|${CLUSTER_PEER}|g" \ -e "s|\$ALERT_DISCORD_IDS|${ALERT_DISCORD_IDS}|g" \ /etc/prometheus/prometheus.yml.example > /etc/prometheus/prometheus.yml