-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into re-2319/expire-crib
- Loading branch information
Showing
189 changed files
with
6,605 additions
and
5,014 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 50 additions & 24 deletions
74
charts/chainlink-cluster/dashboard/cmd/dashboard_deploy.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,75 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"fmt" | ||
"github.com/smartcontractkit/chainlink/charts/chainlink-cluster/dashboard/dashboard" | ||
"github.com/smartcontractkit/wasp" | ||
"os" | ||
"strings" | ||
) | ||
|
||
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") | ||
} | ||
os.Setenv("DATA_SOURCE_NAME", ldsn) | ||
pdsn := os.Getenv("PROMETHEUS_DATA_SOURCE_NAME") | ||
if ldsn == "" { | ||
panic("DATA_SOURCE_NAME must be provided") | ||
|
||
lokiDataSourceName := os.Getenv("LOKI_DATA_SOURCE_NAME") | ||
if lokiDataSourceName == "" { | ||
fmt.Println("LOKI_DATA_SOURCE_NAME is empty, panels with logs will be disabled") | ||
} | ||
dbf := os.Getenv("DASHBOARD_FOLDER") | ||
if dbf == "" { | ||
panic("DASHBOARD_FOLDER must be provided") | ||
|
||
prometheusDataSourceName := os.Getenv("PROMETHEUS_DATA_SOURCE_NAME") | ||
if prometheusDataSourceName == "" { | ||
panic("PROMETHEUS_DATA_SOURCE_NAME 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(6, name, ldsn, pdsn, dbf, grafanaURL, grafanaToken, nil) | ||
if err != nil { | ||
panic(err) | ||
|
||
grafanaFolder := os.Getenv("GRAFANA_FOLDER") | ||
if grafanaFolder == "" { | ||
panic("GRAFANA_FOLDER must be provided") | ||
} | ||
// here we are extending load testing dashboard with core metrics, for example | ||
wdb, err := wasp.NewDashboard(nil, db.Opts()) | ||
if err != nil { | ||
panic(err) | ||
|
||
infraPlatform := os.Getenv("INFRA_PLATFORM") | ||
if infraPlatform == "" { | ||
panic("INFRA_PLATFORM must be provided, can be either docker|kubernetes") | ||
} | ||
if _, err := wdb.Deploy(); err != nil { | ||
panic(err) | ||
|
||
panelsIncluded := os.Getenv("PANELS_INCLUDED") | ||
// can be empty | ||
if panelsIncluded == "" { | ||
fmt.Println("PANELS_INCLUDED can be provided to specify panels groups, value must be separated by comma. Possible values are: core, wasp") | ||
} | ||
panelsIncludedArray := strings.Split(panelsIncluded, ",") | ||
|
||
err := dashboard.NewDashboard( | ||
name, | ||
grafanaURL, | ||
grafanaToken, | ||
grafanaFolder, | ||
[]string{"generated"}, | ||
lokiDataSourceName, | ||
prometheusDataSourceName, | ||
infraPlatform, | ||
panelsIncludedArray, | ||
nil, | ||
) | ||
if err != nil { | ||
fmt.Printf("Could not create dashbard: %s\n", name) | ||
fmt.Printf("Error: %s\n", err) | ||
os.Exit(1) | ||
} | ||
fmt.Printf("Successfully deployed %s dashboard on grafana instance %s in folder %s\n", | ||
name, | ||
grafanaURL, | ||
grafanaFolder, | ||
) | ||
} |
Oops, something went wrong.