Skip to content

Commit

Permalink
Devspace update + Cluster dashboard (#11222)
Browse files Browse the repository at this point in the history
* fix chainlink config

* init dashboard

* bump CTF

* move dashboard rows

* dashboard

* comments

* exclude dashboard from SonarQube

* common dashboard

* extend opts

* rg filter
  • Loading branch information
skudasov authored Nov 16, 2023
1 parent a9d81ae commit 4eb170b
Show file tree
Hide file tree
Showing 10 changed files with 505 additions and 12 deletions.
21 changes: 20 additions & 1 deletion charts/chainlink-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ If you don't need a build use
devspace deploy --skip-build
```

Connect to your environment
Connect to your environment, by replacing container with label `node-1` with your local repository files
```
devspace dev -p node
make chainlink
Expand Down Expand Up @@ -117,4 +117,23 @@ helm test cl-cluster
## Uninstall
```
helm uninstall cl-cluster
```

# Grafana dashboard
We are using [Grabana]() lib to create dashboards programmatically
```
export GRAFANA_URL=...
export GRAFANA_TOKEN=...
export LOKI_DATA_SOURCE_NAME=Loki
export PROMETHEUS_DATA_SOURCE_NAME=Thanos
export DASHBOARD_FOLDER=CLClusterEphemeralDevspace
export DASHBOARD_NAME=ChainlinkCluster
cd dashboard/cmd && go run dashboard_deploy.go
```
Open Grafana folder `CLClusterEphemeralDevspace` and find dashboard `ChainlinkCluster`

If you'd like to add more metrics or verify that all of them are added you can have the full list using IDE search or `ripgrep`:
```
rg -U ".*promauto.*\n.*Name: \"(.*)\"" ../.. > metrics.txt
```
42 changes: 42 additions & 0 deletions charts/chainlink-cluster/dashboard/cmd/dashboard_deploy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package main

import (
"os"

"github.com/smartcontractkit/chainlink/v2/dashboard/dashboard"
)

func main() {
name := os.Getenv("DASHBOARD_NAME")
if name == "" {
panic("DASHBOARD_NAME must be provided")
}
ldsn := os.Getenv("LOKI_DATA_SOURCE_NAME")
if ldsn == "" {
panic("DATA_SOURCE_NAME must be provided")
}
pdsn := os.Getenv("PROMETHEUS_DATA_SOURCE_NAME")
if ldsn == "" {
panic("DATA_SOURCE_NAME must be provided")
}
dbf := os.Getenv("DASHBOARD_FOLDER")
if dbf == "" {
panic("DASHBOARD_FOLDER must be provided")
}
grafanaURL := os.Getenv("GRAFANA_URL")
if grafanaURL == "" {
panic("GRAFANA_URL must be provided")
}
grafanaToken := os.Getenv("GRAFANA_TOKEN")
if grafanaToken == "" {
panic("GRAFANA_TOKEN must be provided")
}
// if you'll use this dashboard base in other projects, you can add your own opts here to extend it
db, err := dashboard.NewCLClusterDashboard(name, ldsn, pdsn, dbf, grafanaURL, grafanaToken, nil)
if err != nil {
panic(err)
}
if err := db.Deploy(); err != nil {
panic(err)
}
}
Loading

0 comments on commit 4eb170b

Please sign in to comment.