Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devspace update + Cluster dashboard #11222

Merged
merged 12 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Maybe use a fatal log or something instead? I'm not a huge fan of using panics this way, as it has a confusing layout for errors like this.

}
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
Loading