Skip to content

Commit 07a4ee3

Browse files
committed
Ingester: Added -blocks-storage.tsdb.head-chunks-write-queue-size allowing to configure the size of the in-memory queue used before flushing chunks to the disk . #4889
1 parent d595cba commit 07a4ee3

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

pkg/ingester/ingester.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,7 @@ func (i *Ingester) createTSDB(userID string) (*userTSDB, error) {
18461846
EnableExemplarStorage: enableExemplars,
18471847
IsolationDisabled: true,
18481848
MaxExemplars: int64(i.cfg.BlocksStorageConfig.TSDB.MaxExemplars),
1849+
HeadChunksWriteQueueSize: i.cfg.BlocksStorageConfig.TSDB.HeadChunksWriteQueueSize,
18491850
}, nil)
18501851
if err != nil {
18511852
return nil, errors.Wrapf(err, "failed to open TSDB: %s", udir)

pkg/ingester/metrics.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ type tsdbMetrics struct {
355355
tsdbChunksCreatedTotal *prometheus.Desc
356356
tsdbChunksRemovedTotal *prometheus.Desc
357357
tsdbMmapChunkCorruptionTotal *prometheus.Desc
358+
tsdbChunkwriteQueueOperationsTotal *prometheus.Desc
358359

359360
tsdbExemplarsTotal *prometheus.Desc
360361
tsdbExemplarsInStorage *prometheus.Desc
@@ -478,6 +479,10 @@ func newTSDBMetrics(r prometheus.Registerer) *tsdbMetrics {
478479
"cortex_ingester_tsdb_mmap_chunk_corruptions_total",
479480
"Total number of memory-mapped TSDB chunk corruptions.",
480481
nil, nil),
482+
tsdbChunkwriteQueueOperationsTotal: prometheus.NewDesc(
483+
"cortex_ingester_tsdb_chunk_write_queue_operations_total",
484+
"Number of currently tsdb chunk write queues.",
485+
[]string{"user", "operation"}, nil),
481486
tsdbLoadedBlocks: prometheus.NewDesc(
482487
"cortex_ingester_tsdb_blocks_loaded",
483488
"Number of currently loaded data blocks",
@@ -579,6 +584,7 @@ func (sm *tsdbMetrics) Describe(out chan<- *prometheus.Desc) {
579584
out <- sm.tsdbChunksCreatedTotal
580585
out <- sm.tsdbChunksRemovedTotal
581586
out <- sm.tsdbMmapChunkCorruptionTotal
587+
out <- sm.tsdbChunkwriteQueueOperationsTotal
582588
out <- sm.tsdbLoadedBlocks
583589
out <- sm.tsdbSymbolTableSize
584590
out <- sm.tsdbReloads
@@ -628,6 +634,7 @@ func (sm *tsdbMetrics) Collect(out chan<- prometheus.Metric) {
628634
data.SendSumOfCountersPerUser(out, sm.tsdbChunksCreatedTotal, "prometheus_tsdb_head_chunks_created_total")
629635
data.SendSumOfCountersPerUser(out, sm.tsdbChunksRemovedTotal, "prometheus_tsdb_head_chunks_removed_total")
630636
data.SendSumOfCounters(out, sm.tsdbMmapChunkCorruptionTotal, "prometheus_tsdb_mmap_chunk_corruptions_total")
637+
data.SendSumOfCountersPerUserWithLabels(out, sm.tsdbChunkwriteQueueOperationsTotal, "prometheus_tsdb_chunk_write_queue_operations_total", "operation")
631638
data.SendSumOfGauges(out, sm.tsdbLoadedBlocks, "prometheus_tsdb_blocks_loaded")
632639
data.SendSumOfGaugesPerUser(out, sm.tsdbSymbolTableSize, "prometheus_tsdb_symbol_table_size_bytes")
633640
data.SendSumOfCounters(out, sm.tsdbReloads, "prometheus_tsdb_reloads_total")

pkg/storage/tsdb/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ type TSDBConfig struct {
136136
WALSegmentSizeBytes int `yaml:"wal_segment_size_bytes"`
137137
FlushBlocksOnShutdown bool `yaml:"flush_blocks_on_shutdown"`
138138
CloseIdleTSDBTimeout time.Duration `yaml:"close_idle_tsdb_timeout"`
139+
//The size of the in-memory queue used before flushing chunks to the disk.
140+
HeadChunksWriteQueueSize int `yaml:"head_chunks_write_queue_size"`
139141

140142
// MaxTSDBOpeningConcurrencyOnStartup limits the number of concurrently opening TSDB's during startup.
141143
MaxTSDBOpeningConcurrencyOnStartup int `yaml:"max_tsdb_opening_concurrency_on_startup"`

0 commit comments

Comments
 (0)