(streamPushChan chan *streamWriteJob, streamCtx context.Context, streamCancel context.CancelFunc)
| 202 | } |
| 203 | |
| 204 | func (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 | |
| 227 | func (c *closableHealthAndIngesterClient) worker(ctx context.Context) error { |
| 228 | stream, err := c.PushStream(ctx) |
no test coverage detected