Skip to content

Commit

Permalink
fix: Harvest should log errors when grafana import fails
Browse files Browse the repository at this point in the history
Thanks to Chris Gautcher (@gautcher) for raising.
  • Loading branch information
cgrinds committed Jun 3, 2024
1 parent 042b450 commit 78975c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/tools/grafana/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func initImportVars() {
switch {
case opts.dir == "grafana/dashboards" && opts.serverfolder.name == "":
m[filepath.Join(opts.dir, "cmode")] = &Folder{name: "Harvest-" + harvestRelease + "-cDOT"}
m[filepath.Join(opts.dir, "cmode", "details")] = &Folder{name: "Harvest-" + harvestRelease + "-cDOT Details"}
m[filepath.Join(opts.dir, "cmode-details")] = &Folder{name: "Harvest-" + harvestRelease + "-cDOT Details"}
m[filepath.Join(opts.dir, "7mode")] = &Folder{name: "Harvest-" + harvestRelease + "-7mode"}
m[filepath.Join(opts.dir, "storagegrid")] = &Folder{name: "Harvest-" + harvestRelease + "-StorageGrid"}
case opts.dir != "" && opts.serverfolder.name != "":
Expand Down
8 changes: 2 additions & 6 deletions integration/test/grafana/grafana_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
type Mgr struct {
}

func (g *Mgr) Import(jsonDir string) (bool, string) {
func (g *Mgr) Import() (bool, string) {
var (
importOutput string
status bool
Expand All @@ -31,15 +31,11 @@ func (g *Mgr) Import(jsonDir string) (bool, string) {
if err != nil {
panic(err)
}
directoryOption := ""
if jsonDir != "" {
directoryOption = "--directory"
}
grafanaURL := utils.GetGrafanaURL()
if docker.IsDockerBasedPoller() {
grafanaURL = "grafana:3000"
}
importCmds := []string{"grafana", "import", "--overwrite", "--addr", grafanaURL, directoryOption, jsonDir}
importCmds := []string{"grafana", "import", "--overwrite", "--addr", grafanaURL}
if docker.IsDockerBasedPoller() {
params := []string{"exec", containerIDs[0].ID, "bin/harvest"}
params = append(params, importCmds...)
Expand Down

0 comments on commit 78975c0

Please sign in to comment.