QueueManager manages a queue of samples to be sent to the Storage indicated by the provided WriteClient. Implements writeTo interface used by WAL Watcher.
| 419 | // indicated by the provided WriteClient. Implements writeTo interface |
| 420 | // used by WAL Watcher. |
| 421 | type QueueManager struct { |
| 422 | lastSendTimestamp atomic.Int64 |
| 423 | buildRequestLimitTimestamp atomic.Int64 |
| 424 | reshardDisableStartTimestamp atomic.Int64 // Time that reshard was disabled. |
| 425 | reshardDisableEndTimestamp atomic.Int64 // Time that reshard is disabled until. |
| 426 | |
| 427 | logger *slog.Logger |
| 428 | flushDeadline time.Duration |
| 429 | cfg config.QueueConfig |
| 430 | mcfg config.MetadataConfig |
| 431 | externalLabels []labels.Label |
| 432 | relabelConfigs []*relabel.Config |
| 433 | sendExemplars bool |
| 434 | sendNativeHistograms bool |
| 435 | enableTypeAndUnitLabels bool |
| 436 | watcher *wlog.Watcher |
| 437 | metadataWatcher *MetadataWatcher |
| 438 | |
| 439 | clientMtx sync.RWMutex |
| 440 | storeClient WriteClient |
| 441 | protoMsg remoteapi.WriteMessageType |
| 442 | compr compression.Type |
| 443 | |
| 444 | seriesMtx sync.Mutex // Covers seriesLabels, seriesMetadata, droppedSeries and builder. |
| 445 | seriesLabels map[chunks.HeadSeriesRef]labels.Labels |
| 446 | seriesMetadata map[chunks.HeadSeriesRef]*metadata.Metadata |
| 447 | droppedSeries map[chunks.HeadSeriesRef]struct{} |
| 448 | builder *labels.Builder |
| 449 | |
| 450 | seriesSegmentMtx sync.Mutex // Covers seriesSegmentIndexes - if you also lock seriesMtx, take seriesMtx first. |
| 451 | seriesSegmentIndexes map[chunks.HeadSeriesRef]int |
| 452 | |
| 453 | shards *shards |
| 454 | numShards int |
| 455 | reshardChan chan int |
| 456 | quit chan struct{} |
| 457 | wg sync.WaitGroup |
| 458 | |
| 459 | dataIn, dataDropped, dataOut, dataOutDuration *ewmaRate |
| 460 | |
| 461 | metrics *queueManagerMetrics |
| 462 | interner *pool |
| 463 | highestRecvTimestamp *maxTimestamp |
| 464 | } |
| 465 | |
| 466 | // NewQueueManager builds a new QueueManager and starts a new |
| 467 | // WAL watcher with queue manager as the WriteTo destination. |
nothing calls this directly
no outgoing calls
no test coverage detected