Skip to content
← All reviews
grafana/grafana #128724 · filewalkwithme · 4mo ago

Provisioning: retry dashboard provisioning while the folder API is unavailable

Needs attention2 findings · openOpen the pull request on GitHub ↗
Panel verdict

The panel surfaced issues that deserve attention before merge.

2
raised by reviewers
2
kept by the panel

Findings

HighCorrectnessconfidence 0.95

isRetriableFolderError may miss wrapped gRPC status errors

The function isRetriableFolderError checks status.Code(err) directly, but status.Code returns codes.Unknown for errors that are not a gRPC status or are wrapped with fmt.Errorf("...: %w", err). The gRPC status library's FromError helper is the correct way to unwrap the error chain. If the underlying gRPC status error is wrapped (e.g. fmt.Errorf("%w: %w", dashboards.ErrGetOrCreateFolder, status.Error(...))), status.Code(err) will return codes.Unknown and the retry will not trigger, defeating the purpose of the change. The test at line 117 wraps the gRPC error with fmt.Errorf("%w: %w", ...) which happens to work because status.Code does unwrap one level via errors.Unwrap, but deeper wrapping or different wrapping patterns would break.

LowArchitectureconfidence 0.80

time.After timer not stopped on context cancellation

In provisionDashboardsWithRetry, time.After creates a timer that is not explicitly stopped when the context is cancelled. If the context is cancelled during the backoff, the function returns immediately but the timer remains allocated until it fires (up to 15 seconds). This is a minor resource leak. Consider using time.NewTimer and stopping it on cancellation to free the timer resource promptly.

3 reviewers · deepseek/deepseek-v4-flash · reviewed in 17s · 6 files, +240 −3

Ship the PR.
Skip the noise.

Free on 2 repositories · No credit card · Advisory only—never blocks a merge