Skip to content

Commit

Permalink
avoid manual copy, use uploaddashboard method
Browse files Browse the repository at this point in the history
  • Loading branch information
fmartingr committed Dec 13, 2024
1 parent 56a526f commit f62d997
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions deployment/terraform/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ func (t *Terraform) setupMetrics(extAgent *ssh.ExtAgent) error {
// Removes the DS_PROMETHEUS variable requirement to allow grafana to use the only prometheus
// datasource available in the load-test envionment.
re := regexp.MustCompile(`,\r?\n\s+\"uid\":\s?\"\$\{DS_PROMETHEUS\}\"`)
result := re.ReplaceAll(dashboardV2Contents.Bytes(), []byte(``))
result := re.ReplaceAllString(dashboardV2Contents.String(), "")

if out, err := sshc.Upload(bytes.NewReader(result), "/var/lib/grafana/dashboards/dashboard_v2.json", true); err != nil {
return fmt.Errorf("error while uploading dashboard v2: output: %s, error: %w", out, err)
if _, err := t.UploadDashboard(result); err != nil {
return fmt.Errorf("error while uploading dashboard: %w", err)
}

// Upload coordinator metrics dashboard
Expand Down

0 comments on commit f62d997

Please sign in to comment.