Skip to content

Commit

Permalink
feat(dashboard): create DON dashboard (#12738)
Browse files Browse the repository at this point in the history
* feat(dashboard): add DON ocr contract panels

* feat(dashboard): add panels included env var

* feat(dashboard): add panels for round epoch progression

* feat(dashboard): add summary don panels

* feat(dashboard): cleanup

* chore: modify sonarkube code duplication exclusion

* feat(dashboard): delete dashboard

* feat(dashboard): adapt for multiple ocr versions

* feat(dashboard): DON dashboard for all ocr versions

* feat(dashbord): separated PR for core components

* feat(dashboard): correct escaping for k8s vars
  • Loading branch information
Atrax1 authored Apr 16, 2024
1 parent f7982fa commit d97f14b
Show file tree
Hide file tree
Showing 10 changed files with 784 additions and 20 deletions.
5 changes: 4 additions & 1 deletion charts/chainlink-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ We are using [Grabana](https://github.com/K-Phoen/grabana) lib to create dashboa

You can also select dashboard platform in `INFRA_PLATFORM` either `kubernetes` or `docker`

You can select the dashboard panels with `PANELS_INCLUDED` which is a list of panel names separated by comma
If you don't specify it will include core panels by default

```
export LOKI_TENANT_ID=promtail
export LOKI_URL=...
Expand All @@ -159,7 +162,7 @@ export GRAFANA_TOKEN=...
export PROMETHEUS_DATA_SOURCE_NAME=Thanos
export LOKI_DATA_SOURCE_NAME=Loki
export INFRA_PLATFORM=kubernetes
export GRAFANA_FOLDER=CRIB
export GRAFANA_FOLDER=DashboardCoreDebug
export DASHBOARD_NAME=CL-Cluster
devspace run dashboard_deploy
Expand Down
19 changes: 19 additions & 0 deletions charts/chainlink-cluster/dashboard/cmd/delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package main

import (
lib "github.com/smartcontractkit/chainlink/dashboard-lib"
)

func main() {
cfg := lib.ReadEnvDeployOpts()
db := lib.NewDashboard(cfg.Name, cfg, nil)
err := db.Delete()
if err != nil {
lib.L.Fatal().Err(err).Msg("failed to delete the dashboard")
}
lib.L.Info().
Str("Name", db.Name).
Str("GrafanaURL", db.DeployOpts.GrafanaURL).
Str("GrafanaFolder", db.DeployOpts.GrafanaFolder).
Msg("Dashboard deleted")
}
47 changes: 31 additions & 16 deletions charts/chainlink-cluster/dashboard/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,48 @@ package main
import (
"github.com/K-Phoen/grabana/dashboard"
lib "github.com/smartcontractkit/chainlink/dashboard-lib"
atlas_don "github.com/smartcontractkit/chainlink/dashboard-lib/atlas-don"
core_don "github.com/smartcontractkit/chainlink/dashboard-lib/core-don"
k8spods "github.com/smartcontractkit/chainlink/dashboard-lib/k8s-pods"
waspdb "github.com/smartcontractkit/wasp/dashboard"
)

const (
DashboardName = "Chainlink Cluster (DON)"
"strings"
)

func main() {
cfg := lib.ReadEnvDeployOpts()
db := lib.NewDashboard(DashboardName, cfg,
db := lib.NewDashboard(cfg.Name, cfg,
[]dashboard.Option{
dashboard.AutoRefresh("10s"),
dashboard.Tags([]string{"generated"}),
},
)
db.Add(
core_don.New(
core_don.Props{
PrometheusDataSource: cfg.DataSources.Prometheus,
PlatformOpts: core_don.PlatformPanelOpts(cfg.Platform),
},
),
)
if len(cfg.PanelsIncluded) == 0 || cfg.PanelsIncluded["core"] {
db.Add(
core_don.New(
core_don.Props{
PrometheusDataSource: cfg.DataSources.Prometheus,
PlatformOpts: core_don.PlatformPanelOpts(cfg.Platform),
},
),
)
// TODO: refactor as a component later
addWASPRows(db, cfg)
}
if cfg.PanelsIncluded["ocr"] || cfg.PanelsIncluded["ocr2"] || cfg.PanelsIncluded["ocr3"] {
for key := range cfg.PanelsIncluded {
if strings.Contains(key, "ocr") {
db.Add(
atlas_don.New(
atlas_don.Props{
PrometheusDataSource: cfg.DataSources.Prometheus,
PlatformOpts: atlas_don.PlatformPanelOpts(cfg.Platform, key),
OcrVersion: key,
},
),
)
}
}
}
if cfg.Platform == "kubernetes" {
db.Add(
k8spods.New(
Expand All @@ -38,13 +55,11 @@ func main() {
),
)
}
// TODO: refactor as a component later
addWASPRows(db, cfg)
if err := db.Deploy(); err != nil {
lib.L.Fatal().Err(err).Msg("failed to deploy the dashboard")
}
lib.L.Info().
Str("Name", DashboardName).
Str("Name", db.Name).
Str("GrafanaURL", db.DeployOpts.GrafanaURL).
Str("GrafanaFolder", db.DeployOpts.GrafanaFolder).
Msg("Dashboard deployed")
Expand Down
Loading

0 comments on commit d97f14b

Please sign in to comment.