Skip to content

Dashboards as Code#97

Draft
otherview wants to merge 2 commits intomainfrom
pedro/generate_dashboards
Draft

Dashboards as Code#97
otherview wants to merge 2 commits intomainfrom
pedro/generate_dashboards

Conversation

@otherview
Copy link
Member

@otherview otherview commented Oct 30, 2025

Summary

Introduces a comprehensive dashboard generation system that replaces manual JSON management with programmatic,
type-safe dashboard creation. All 12 VeChain Thor monitoring dashboards are now generated as code using the Grafana
Foundation SDK.

What's New: Dashboards as Code

🏗️ Complete Dashboard Generation System

  • New dashgen package: Modular CLI tool for generating Grafana dashboards programmatically
  • 12 Generated Dashboards: Network overview, validators, DPoS metrics, authority monitoring, and more
  • Type-Safe Construction: Uses Grafana Foundation SDK for compile-time validation

🔧 Developer Experience

  • Docker Integration: Full development workflow with file watching and auto-regeneration
  • Make Commands: make dashgen-dev for convenient development iteration
  • Live Reload: Changes to Go code automatically regenerate dashboards in Grafana
  • Documentation: Comprehensive guides for usage and extending the system

Key Benefits

🎯 Maintainability

  • DRY Principle: Shared components eliminate 300+ lines of duplicate HTML
  • Layout Constants: Centralized positioning with HeaderHeight, PanelHeight, etc.
  • Consistent Styling: All dashboards use standardized VeChain branding

🔄 Scalability

  • Easy Extensions: Adding new dashboards requires only implementing the Dashboard interface
  • Panel Reusability: Shared panel builders for common patterns (stats, time series, tables)
  • Configuration: Centralized InfluxDB data source and styling configuration

🛡️ Reliability

  • Compile-Time Validation: Catch errors before runtime with SDK type checking
  • Automated Testing: Dashboard generation tested in CI/CD pipeline
  • Consistent Output: Eliminates manual JSON editing errors and formatting inconsistencies

Technical Implementation

Architecture

dashgen/
├── cmd/main.go              # CLI tool
├── dashboards/              # Dashboard definitions
│   ├── network_overview.go  # Network monitoring
│   ├── dpos_*.go           # DPoS validator dashboards (7 files)
│   └── authority_*.go       # Authority node dashboards
├── html.go                  # Shared HTML builders
└── query.go                 # Common query patterns

Docker Workflow

  • Development Mode: File watching with automatic regeneration
  • Production Ready: Single-shot generation for deployment
  • Grafana Integration: Generated dashboards auto-provisioned via volume mounts

Migration Path

  • Removed: Manual JSON files from grafana/dashboards/
  • Added: Generated dashboards in grafana/gen-dashboards/
  • Preserved: All existing dashboard functionality and InfluxDB queries
  • Enhanced: Better positioning, consistent styling, maintainable codebase

@otherview otherview marked this pull request as draft October 30, 2025 15:33
@socket-security
Copy link

socket-security bot commented Oct 30, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub.com/​grafana/​grafana-foundation-sdk/​go@​v0.0.0-20250310114924-e8eb8530bc7c99100100100100

View full report

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.

1 participant