MCPcopy
hub / github.com/kopia/kopia / pushPeriodically

Method pushPeriodically

cli/observability_flags.go:298–315  ·  view source on GitHub ↗
(ctx context.Context, p *push.Pusher)

Source from the content-addressed store, hash-verified

296}
297
298func (c *observabilityFlags) pushPeriodically(ctx context.Context, p *push.Pusher) {
299 defer c.pusherWG.Done()
300
301 ticker := time.NewTicker(c.metricsPushInterval)
302
303 for {
304 select {
305 case <-ticker.C:
306 c.pushOnce(ctx, "periodic", p)
307
308 case <-c.stopPusher:
309 ticker.Stop()
310 c.pushOnce(ctx, "final", p)
311
312 return
313 }
314 }
315}
316
317func (c *observabilityFlags) pushOnce(ctx context.Context, kind string, p *push.Pusher) {
318 log(ctx).Debugw("pushing prometheus metrics", "kind", kind)

Callers 1

Calls 4

pushOnceMethod · 0.95
NewTickerMethod · 0.80
DoneMethod · 0.65
StopMethod · 0.45

Tested by

no test coverage detected