mirror of
https://github.com/grafana/grafana.git
synced 2025-01-26 16:27:02 -06:00
Remove extra defers in screenshot sevice (#84697)
This commit is contained in:
parent
034c232ec9
commit
f3e5ad00d6
@ -132,22 +132,22 @@ func (s *HeadlessScreenshotService) Take(ctx context.Context, opts ScreenshotOpt
|
||||
return nil, fmt.Errorf("failed to take screenshot: %w", err)
|
||||
}
|
||||
|
||||
defer s.successes.Inc()
|
||||
s.successes.Inc()
|
||||
screenshot := Screenshot{Path: result.FilePath}
|
||||
return &screenshot, nil
|
||||
}
|
||||
|
||||
func (s *HeadlessScreenshotService) instrumentError(err error) {
|
||||
if errors.Is(err, dashboards.ErrDashboardNotFound) {
|
||||
defer s.failures.With(prometheus.Labels{
|
||||
s.failures.With(prometheus.Labels{
|
||||
"reason": "dashboard_not_found",
|
||||
}).Inc()
|
||||
} else if errors.Is(err, context.Canceled) {
|
||||
defer s.failures.With(prometheus.Labels{
|
||||
s.failures.With(prometheus.Labels{
|
||||
"reason": "context_canceled",
|
||||
}).Inc()
|
||||
} else {
|
||||
defer s.failures.With(prometheus.Labels{
|
||||
s.failures.With(prometheus.Labels{
|
||||
"reason": "error",
|
||||
}).Inc()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user