MCPcopy
hub / github.com/grafana/tempo / reportUsage

Method reportUsage

pkg/usagestats/reporter.go:289–307  ·  view source on GitHub ↗

reportUsage reports the usage to grafana.com.

(ctx context.Context, interval time.Time)

Source from the content-addressed store, hash-verified

287
288// reportUsage reports the usage to grafana.com.
289func (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.

Callers 1

runningMethod · 0.95

Calls 4

sendReportFunction · 0.85
LogMethod · 0.65
AddMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected