Skip to content

Commit

Permalink
fix: Ignore all stackdriver errors if --stackdriver-only-when-availab…
Browse files Browse the repository at this point in the history
…le is set (#2304)

Signed-off-by: Max Smythe <smythe@google.com>

Signed-off-by: Max Smythe <smythe@google.com>
  • Loading branch information
maxsmythe committed Sep 30, 2022
1 parent 70a65fa commit 9a56db9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/metrics/exporters/stackdriver/stackdriver.go
Expand Up @@ -36,10 +36,18 @@ func Start(ctx context.Context) error {
MonitoredResource: monitoredresource.Autodetect(),
})
if err != nil {
if *ignoreMissingCreds {
log.Error(err, "Error initializing stackdriver exporter, not exporting stackdriver metrics")
return nil
}
return err
}

if err := exporter.StartMetricsExporter(); err != nil {
if *ignoreMissingCreds {
log.Error(err, "Error starting stackdriver exporter, not exporting stackdriver metrics")
return nil
}
return err
}
defer exporter.StopMetricsExporter()
Expand Down

0 comments on commit 9a56db9

Please sign in to comment.