Make subgraph ids for alerts configurable
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 39s
Deploy Test / Run deploy test suite (pull_request) Successful in 4m58s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m0s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 9m21s
Smoke Test / Run basic test suite (pull_request) Successful in 4m32s

This commit is contained in:
Prathamesh Musale 2024-05-10 14:49:20 +05:30
parent b0501fddeb
commit 96b41e7307
4 changed files with 24 additions and 4 deletions

View File

@ -6,10 +6,16 @@ services:
restart: always restart: always
environment: environment:
GF_SERVER_ROOT_URL: ${GF_SERVER_ROOT_URL} GF_SERVER_ROOT_URL: ${GF_SERVER_ROOT_URL}
CERC_GRAFANA_ALERTS_SUBGRAPH_IDS: ${CERC_GRAFANA_ALERTS_SUBGRAPH_IDS}
volumes: volumes:
- ../config/monitoring/grafana/provisioning:/etc/grafana/provisioning - ../config/monitoring/grafana/provisioning:/etc/grafana/provisioning
- ../config/monitoring/grafana/dashboards:/etc/grafana/dashboards - ../config/monitoring/grafana/dashboards:/etc/grafana/dashboards
- ../config/monitoring/update-grafana-alerts-config.sh:/update-grafana-alerts-config.sh
- grafana_storage:/var/lib/grafana - grafana_storage:/var/lib/grafana
user: root
entrypoint: ["bash", "-c"]
command: |
"/update-grafana-alerts-config.sh && /run.sh"
ports: ports:
- "3000" - "3000"
healthcheck: healthcheck:

View File

@ -19,7 +19,7 @@ groups:
type: prometheus type: prometheus
uid: PBFA97CFB590B2093 uid: PBFA97CFB590B2093
editorMode: code editorMode: code
expr: ethereum_chain_head_number - on(network) group_right deployment_head{} expr: ethereum_chain_head_number - on(network) group_right deployment_head{deployment=~"REPLACE_WITH_SUBGRAPH_IDS"}
instant: true instant: true
intervalMs: 1000 intervalMs: 1000
legendFormat: __auto legendFormat: __auto
@ -55,7 +55,7 @@ groups:
maxDataPoints: 43200 maxDataPoints: 43200
refId: condition refId: condition
type: threshold type: threshold
noDataState: Alerting noDataState: OK
execErrState: Alerting execErrState: Alerting
for: 5m for: 5m
annotations: annotations:

View File

@ -0,0 +1,7 @@
#!/bin/bash
echo Using CERC_GRAFANA_ALERTS_SUBGRAPH_IDS ${CERC_GRAFANA_ALERTS_SUBGRAPH_IDS}
# Replace subgraph ids in subgraph alerting config
# Note: Requires the grafana container to be run with user root
sed -i "s/REPLACE_WITH_SUBGRAPH_IDS/$CERC_GRAFANA_ALERTS_SUBGRAPH_IDS/g" /etc/grafana/provisioning/alerting/subgraph-alert-rules.yml

View File

@ -119,10 +119,14 @@ Add scrape config as done above for any additional watcher to add it to the Watc
### Grafana alerts config ### Grafana alerts config
Place the pre-configured watcher alerts rules in Grafana provisioning directory: Place the pre-configured alerts rules in Grafana provisioning directory:
```bash ```bash
# watcher alert rules
cp monitoring-watchers-deployment/config/monitoring/watcher-alert-rules.yml monitoring-watchers-deployment/config/monitoring/grafana/provisioning/alerting/ cp monitoring-watchers-deployment/config/monitoring/watcher-alert-rules.yml monitoring-watchers-deployment/config/monitoring/grafana/provisioning/alerting/
# subgraph alert rules
cp monitoring-watchers-deployment/config/monitoring/subgraph-alert-rules.yml monitoring-watchers-deployment/config/monitoring/grafana/provisioning/alerting/
``` ```
Update the alerting contact points config (`monitoring-watchers-deployment/config/monitoring/grafana/provisioning/alerting/contactpoints.yml`) with desired contact points Update the alerting contact points config (`monitoring-watchers-deployment/config/monitoring/grafana/provisioning/alerting/contactpoints.yml`) with desired contact points
@ -135,7 +139,7 @@ Add corresponding routes to the notification policies config (`monitoring-watche
- receiver: SlackNotifier - receiver: SlackNotifier
object_matchers: object_matchers:
# Add matchers below # Add matchers below
- ['grafana_folder', '=', 'WatcherAlerts'] - ['grafana_folder', '=~', 'WatcherAlerts|SubgraphAlerts']
``` ```
### Env ### Env
@ -149,6 +153,9 @@ Set the following env variables in the deployment env config file (`monitoring-w
# Grafana server host URL to be used # Grafana server host URL to be used
# (Optional, default: http://localhost:3000) # (Optional, default: http://localhost:3000)
GF_SERVER_ROOT_URL= GF_SERVER_ROOT_URL=
# List of subgraph ids to configure alerts for (separated by |)
CERC_GRAFANA_ALERTS_SUBGRAPH_IDS=
``` ```
## Start the stack ## Start the stack