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

Method Run

pkg/ingester/client/client.go:204–225  ·  view source on GitHub ↗
(streamPushChan chan *streamWriteJob, streamCtx context.Context, streamCancel context.CancelFunc)

Source from the content-addressed store, hash-verified

202}
203
204func (c *closableHealthAndIngesterClient) Run(streamPushChan chan *streamWriteJob, streamCtx context.Context, streamCancel context.CancelFunc) error {
205 c.streamPushChan = streamPushChan
206 c.streamCtx = streamCtx
207 c.streamCancel = streamCancel
208
209 var workerErr error
210 var wg sync.WaitGroup
211 // Sanitize addr: colons (from host:port) are not allowed in tenant IDs.
212 sanitizedAddr := strings.ReplaceAll(c.addr, ":", "-")
213 for i := range INGESTER_CLIENT_STREAM_WORKER_COUNT {
214 workerName := fmt.Sprintf("ingester-%s-stream-push-worker-%d", sanitizedAddr, i)
215 wg.Go(func() {
216 workerCtx := user.InjectOrgID(streamCtx, workerName)
217 err := c.worker(workerCtx)
218 if err != nil {
219 workerErr = err
220 }
221 })
222 }
223 wg.Wait()
224 return workerErr
225}
226
227func (c *closableHealthAndIngesterClient) worker(ctx context.Context) error {
228 stream, err := c.PushStream(ctx)

Callers 1

MakeIngesterClientFunction · 0.95

Calls 2

workerMethod · 0.95
WaitMethod · 0.45

Tested by

no test coverage detected