reportUsage reports the usage to grafana.com.
(ctx context.Context, interval time.Time)
| 287 | |
| 288 | // reportUsage reports the usage to grafana.com. |
| 289 | func (rep *Reporter) reportUsage(ctx context.Context, interval time.Time) error { |
| 290 | backoff := backoff.New(ctx, backoff.Config{ |
| 291 | MinBackoff: time.Second, |
| 292 | MaxBackoff: 30 * time.Second, |
| 293 | MaxRetries: 5, |
| 294 | }) |
| 295 | var errs multierror.MultiError |
| 296 | for backoff.Ongoing() { |
| 297 | if err := sendReport(ctx, rep.cluster, interval); err != nil { |
| 298 | level.Info(rep.logger).Log("msg", "failed to send usage report", "retries", backoff.NumRetries(), "err", err) |
| 299 | errs.Add(err) |
| 300 | backoff.Wait() |
| 301 | continue |
| 302 | } |
| 303 | level.Debug(rep.logger).Log("msg", "usage report sent with success") |
| 304 | return nil |
| 305 | } |
| 306 | return errs.Err() |
| 307 | } |
| 308 | |
| 309 | // nextReport compute the next report time based on the interval. |
| 310 | // The interval is based off the creation of the cluster seed to avoid all cluster reporting at the same time. |
no test coverage detected