making tsdbOOOHistogram metric per tenant by Shvejan · Pull Request #7279 · cortexproject/cortex · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
4 changes: 2 additions & 2 deletions pkg/ingester/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func newTSDBMetrics(r prometheus.Registerer) *tsdbMetrics {
tsdbOOOHistogram: prometheus.NewDesc(
"cortex_ingester_tsdb_sample_ooo_delta",
"Delta in seconds by which a sample is considered out of order (reported regardless of OOO time window and whether sample is accepted or not).",
nil, nil),
[]string{"user"}, nil),
tsdbMmapChunksTotal: prometheus.NewDesc(
"cortex_ingester_tsdb_mmap_chunks_total",
"Total number of chunks that were memory-mapped.",
Expand Down Expand Up @@ -764,7 +764,7 @@ func (sm *tsdbMetrics) Collect(out chan<- prometheus.Metric) {
data.SendSumOfCountersPerUserWithLabels(out, sm.tsdbOOOSamples, "prometheus_tsdb_out_of_order_samples_total", "type")
data.SendSumOfCountersPerUserWithLabels(out, sm.tsdbOutOfOrderSamplesAppended, "prometheus_tsdb_head_out_of_order_samples_appended_total", "type")
data.SendSumOfCounters(out, sm.tsdbSnapshotReplayErrorTotal, "prometheus_tsdb_snapshot_replay_error_total")
data.SendSumOfHistograms(out, sm.tsdbOOOHistogram, "prometheus_tsdb_sample_ooo_delta")
data.SendSumOfHistogramsPerUser(out, sm.tsdbOOOHistogram, "prometheus_tsdb_sample_ooo_delta")
data.SendSumOfCounters(out, sm.tsdbMmapChunksTotal, "prometheus_tsdb_mmap_chunks_total")
data.SendSumOfCounters(out, sm.checkpointDeleteFail, "prometheus_tsdb_checkpoint_deletions_failed_total")
data.SendSumOfCounters(out, sm.checkpointDeleteTotal, "prometheus_tsdb_checkpoint_deletions_total")
Expand Down
70 changes: 50 additions & 20 deletions pkg/ingester/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,36 @@ func TestTSDBMetrics(t *testing.T) {
cortex_ingester_tsdb_reloads_total 30
# HELP cortex_ingester_tsdb_sample_ooo_delta Delta in seconds by which a sample is considered out of order (reported regardless of OOO time window and whether sample is accepted or not).
# TYPE cortex_ingester_tsdb_sample_ooo_delta histogram
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="600"} 0
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="1800"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="3600"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="7200"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="10800"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="21600"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="43200"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="+Inf"} 3
cortex_ingester_tsdb_sample_ooo_delta_sum 2700
cortex_ingester_tsdb_sample_ooo_delta_count 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="600"} 0
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="1800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="3600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="7200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="10800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="21600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="43200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="+Inf"} 1
cortex_ingester_tsdb_sample_ooo_delta_sum{user="user1"} 900
cortex_ingester_tsdb_sample_ooo_delta_count{user="user1"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="600"} 0
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="1800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="3600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="7200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="10800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="21600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="43200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="+Inf"} 1
cortex_ingester_tsdb_sample_ooo_delta_sum{user="user2"} 900
cortex_ingester_tsdb_sample_ooo_delta_count{user="user2"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user3",le="600"} 0
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user3",le="1800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user3",le="3600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user3",le="7200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user3",le="10800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user3",le="21600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user3",le="43200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user3",le="+Inf"} 1
cortex_ingester_tsdb_sample_ooo_delta_sum{user="user3"} 900
cortex_ingester_tsdb_sample_ooo_delta_count{user="user3"} 1
# HELP cortex_ingester_tsdb_snapshot_replay_error_total Total number snapshot replays that failed.
# TYPE cortex_ingester_tsdb_snapshot_replay_error_total counter
cortex_ingester_tsdb_snapshot_replay_error_total 309
Expand Down Expand Up @@ -778,16 +798,26 @@ func TestTSDBMetricsWithRemoval(t *testing.T) {
cortex_ingester_tsdb_reloads_total 30
# HELP cortex_ingester_tsdb_sample_ooo_delta Delta in seconds by which a sample is considered out of order (reported regardless of OOO time window and whether sample is accepted or not).
# TYPE cortex_ingester_tsdb_sample_ooo_delta histogram
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="600"} 0
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="1800"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="3600"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="7200"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="10800"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="21600"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="43200"} 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{le="+Inf"} 3
cortex_ingester_tsdb_sample_ooo_delta_sum 2700
cortex_ingester_tsdb_sample_ooo_delta_count 3
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="600"} 0
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="1800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="3600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="7200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="10800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="21600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="43200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user1",le="+Inf"} 1
cortex_ingester_tsdb_sample_ooo_delta_sum{user="user1"} 900
cortex_ingester_tsdb_sample_ooo_delta_count{user="user1"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="600"} 0
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="1800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="3600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="7200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="10800"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="21600"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="43200"} 1
cortex_ingester_tsdb_sample_ooo_delta_bucket{user="user2",le="+Inf"} 1
cortex_ingester_tsdb_sample_ooo_delta_sum{user="user2"} 900
cortex_ingester_tsdb_sample_ooo_delta_count{user="user2"} 1
# HELP cortex_ingester_tsdb_snapshot_replay_error_total Total number snapshot replays that failed.
# TYPE cortex_ingester_tsdb_snapshot_replay_error_total counter
cortex_ingester_tsdb_snapshot_replay_error_total 309
Expand Down
10 changes: 10 additions & 0 deletions pkg/util/metrics_helper.go
Loading