Skip to content

feat: start Grafana and Prometheus when --metrics is passed#109

Merged
g11tech merged 4 commits intoblockblaz:mainfrom
lambdaclass:metrics-stack
Feb 7, 2026
Merged

feat: start Grafana and Prometheus when --metrics is passed#109
g11tech merged 4 commits intoblockblaz:mainfrom
lambdaclass:metrics-stack

Conversation

@MegaRedHand
Copy link
Contributor

This PR changes the --metrics flag to specify if a Grafana stack for metrics collection should be started. Adding a default Grafana+Prometheus to this repo improves observability during local devnet runs.

The Grafana dashboards are the ones from leanMetrics: https://github.com/leanEthereum/leanMetrics/tree/main/development

I replaced the existing --metrics flag with the new functionality since it wasn't being used: specifying it was supposed to enable metrics in clients, but they were already enabled by default. As an alternative, we could keep the old documentation, but adding information about the new stack, or introduce a new flag (like --collect-metrics).

Copilot AI review requested due to automatic review settings February 6, 2026 15:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an optional local observability stack that is started/stopped via the existing --metrics flag, providing Prometheus scraping + Grafana dashboards during devnet runs.

Changes:

  • Start/stop a Docker Compose Prometheus+Grafana stack when --metrics is provided (including cleanup/stop handling).
  • Add scripts/config to generate Prometheus scrape targets from validator-config.yaml and provision Grafana dashboards/datasource.
  • Update README/docs and ignore generated metrics/prometheus/prometheus.yml.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
spin-node.sh Starts/stops metrics stack on --metrics for local runs and during cleanup/stop.
generate-prometheus-config.sh Generates prometheus.yml scrape targets from validator-config.yaml.
metrics/docker-compose-metrics.yaml Defines Prometheus + Grafana services for local monitoring.
metrics/grafana/provisioning/datasources/prometheus.yml Provisions Grafana Prometheus datasource.
metrics/grafana/provisioning/dashboards/dashboards.yml Provisions Grafana dashboards from the mounted dashboards directory.
metrics/grafana/dashboards/client-interop-dashboard.json Adds prebuilt Grafana dashboard JSON.
metrics/grafana/dashboards/client-dashboard.json Adds prebuilt Grafana dashboard JSON.
README.md Documents the new --metrics behavior and URLs.
.gitignore Ignores generated Prometheus config file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +32
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grafana is configured with anonymous access as Admin and the login form disabled. Even for local dev, this is a very permissive default (anyone who can reach port 3000 gets full admin capabilities, including adding datasources/plugins). Consider setting the anonymous role to Viewer (or Editor) and/or keeping the login form enabled, and document the default credentials if admin access is needed.

Suggested change
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
- GF_AUTH_DISABLE_LOGIN_FORM=false

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think admin access without login is not a problem for a local devnet

- Use explicit UID for prometheus datasource
- Fix counting issue in log on prom config generation
- Pin Grafana and Prometheus images
- Add host.docker.internal mapping for Linux users
@g11tech g11tech merged commit ed7a6b4 into blockblaz:main Feb 7, 2026
@MegaRedHand MegaRedHand deleted the metrics-stack branch February 7, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants