Skip to content

Commit

Permalink
Ingester: Added -blocks-storage.tsdb.head-chunks-write-queue-size a…
Browse files Browse the repository at this point in the history
…llowing to configure the size of the in-memory queue used before flushing chunks to the disk . cortexproject#5000

Signed-off-by: tanghengjian <1040104807@qq.com>
  • Loading branch information
t00350320 committed Nov 28, 2022
1 parent d595cba commit 4d78243
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
* [FEATURE] QueryFrontend: Support vertical sharding for subqueries. #4955
* [FEATURE] Querier: Added a new limit `-querier.max-fetched-data-bytes-per-query` allowing to limit the maximum size of all data in bytes that a query can fetch from each ingester and storage. #4854
* [FEATURE] Added 2 flags `-alertmanager.alertmanager-client.grpc-compression` and `-querier.store-gateway-client.grpc-compression` to configure compression methods for grpc clients. #4889
* [FEATURE] 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 . #5000
* [BUGFIX] Storage/Bucket: Enable AWS SDK for go authentication for s3 to fix IMDSv1 authentication. #4897
* [BUGFIX] Memberlist: Add join with no retrying when starting service. #4804
* [BUGFIX] Ruler: Fix /ruler/rule_groups returns YAML with extra fields. #4767
Expand Down
1 change: 1 addition & 0 deletions pkg/ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -1846,6 +1846,7 @@ func (i *Ingester) createTSDB(userID string) (*userTSDB, error) {
EnableExemplarStorage: enableExemplars,
IsolationDisabled: true,
MaxExemplars: int64(i.cfg.BlocksStorageConfig.TSDB.MaxExemplars),
HeadChunksWriteQueueSize: i.cfg.BlocksStorageConfig.TSDB.HeadChunksWriteQueueSize,
}, nil)
if err != nil {
return nil, errors.Wrapf(err, "failed to open TSDB: %s", udir)
Expand Down
7 changes: 7 additions & 0 deletions pkg/ingester/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ type tsdbMetrics struct {
tsdbChunksCreatedTotal *prometheus.Desc
tsdbChunksRemovedTotal *prometheus.Desc
tsdbMmapChunkCorruptionTotal *prometheus.Desc
tsdbChunkwriteQueueOperationsTotal *prometheus.Desc

tsdbExemplarsTotal *prometheus.Desc
tsdbExemplarsInStorage *prometheus.Desc
Expand Down Expand Up @@ -478,6 +479,10 @@ func newTSDBMetrics(r prometheus.Registerer) *tsdbMetrics {
"cortex_ingester_tsdb_mmap_chunk_corruptions_total",
"Total number of memory-mapped TSDB chunk corruptions.",
nil, nil),
tsdbChunkwriteQueueOperationsTotal: prometheus.NewDesc(
"cortex_ingester_tsdb_chunk_write_queue_operations_total",
"Number of currently tsdb chunk write queues.",
[]string{"user", "operation"}, nil),
tsdbLoadedBlocks: prometheus.NewDesc(
"cortex_ingester_tsdb_blocks_loaded",
"Number of currently loaded data blocks",
Expand Down Expand Up @@ -579,6 +584,7 @@ func (sm *tsdbMetrics) Describe(out chan<- *prometheus.Desc) {
out <- sm.tsdbChunksCreatedTotal
out <- sm.tsdbChunksRemovedTotal
out <- sm.tsdbMmapChunkCorruptionTotal
out <- sm.tsdbChunkwriteQueueOperationsTotal
out <- sm.tsdbLoadedBlocks
out <- sm.tsdbSymbolTableSize
out <- sm.tsdbReloads
Expand Down Expand Up @@ -628,6 +634,7 @@ func (sm *tsdbMetrics) Collect(out chan<- prometheus.Metric) {
data.SendSumOfCountersPerUser(out, sm.tsdbChunksCreatedTotal, "prometheus_tsdb_head_chunks_created_total")
data.SendSumOfCountersPerUser(out, sm.tsdbChunksRemovedTotal, "prometheus_tsdb_head_chunks_removed_total")
data.SendSumOfCounters(out, sm.tsdbMmapChunkCorruptionTotal, "prometheus_tsdb_mmap_chunk_corruptions_total")
data.SendSumOfCountersPerUserWithLabels(out, sm.tsdbChunkwriteQueueOperationsTotal, "prometheus_tsdb_chunk_write_queue_operations_total", "operation")
data.SendSumOfGauges(out, sm.tsdbLoadedBlocks, "prometheus_tsdb_blocks_loaded")
data.SendSumOfGaugesPerUser(out, sm.tsdbSymbolTableSize, "prometheus_tsdb_symbol_table_size_bytes")
data.SendSumOfCounters(out, sm.tsdbReloads, "prometheus_tsdb_reloads_total")
Expand Down
2 changes: 2 additions & 0 deletions pkg/storage/tsdb/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ type TSDBConfig struct {
WALSegmentSizeBytes int `yaml:"wal_segment_size_bytes"`
FlushBlocksOnShutdown bool `yaml:"flush_blocks_on_shutdown"`
CloseIdleTSDBTimeout time.Duration `yaml:"close_idle_tsdb_timeout"`
//The size of the in-memory queue used before flushing chunks to the disk.
HeadChunksWriteQueueSize int `yaml:"head_chunks_write_queue_size"`

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

0 comments on commit 4d78243

Please sign in to comment.