MCPcopy Create free account
hub / github.com/cortexproject/cortex / running

Method running

pkg/flusher/flusher.go:65–92  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

63}
64
65func (f *Flusher) running(ctx context.Context) error {
66 ing, err := ingester.NewForFlusher(f.ingesterConfig, f.limits, f.registerer, f.logger)
67 if err != nil {
68 return errors.Wrap(err, "create ingester")
69 }
70
71 if err := services.StartAndAwaitRunning(ctx, ing); err != nil {
72 return errors.Wrap(err, "start and await running ingester")
73 }
74
75 ing.Flush()
76
77 // Sleeping to give a chance to Prometheus
78 // to collect the metrics.
79 level.Info(f.logger).Log("msg", "sleeping to give chance for collection of metrics", "duration", postFlushSleepTime.String())
80 time.Sleep(postFlushSleepTime)
81
82 if err := services.StopAndAwaitTerminated(ctx, ing); err != nil {
83 return errors.Wrap(err, "stop and await terminated ingester")
84 }
85
86 if f.cfg.ExitAfterFlush {
87 return modules.ErrStopProcess
88 }
89
90 // Return normally -- this keep Cortex running.
91 return nil
92}

Callers

nothing calls this directly

Calls 7

NewForFlusherFunction · 0.92
StartAndAwaitRunningFunction · 0.92
StopAndAwaitTerminatedFunction · 0.92
WrapMethod · 0.65
FlushMethod · 0.65
StringMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected