diff --git a/components/engine_rocks/src/rocks_metrics.rs b/components/engine_rocks/src/rocks_metrics.rs index 438b108bb85..b3f7fd5a221 100644 --- a/components/engine_rocks/src/rocks_metrics.rs +++ b/components/engine_rocks/src/rocks_metrics.rs @@ -94,6 +94,10 @@ make_auto_flush_static_metric! { failure, success, trigger_next, + last_level_seek_filtered, + last_level_seek_filter_match, + non_last_level_seek_filtered, + non_last_level_seek_filter_match, } pub struct EngineTickerMetrics : LocalIntCounter { @@ -228,6 +232,30 @@ pub fn flush_engine_ticker_metrics(t: TickerType, value: u64, name: &str) { .bloom_useful .inc_by(value); } + TickerType::LastLevelSeekFiltered => { + STORE_ENGINE_BLOOM_EFFICIENCY + .get(name_enum) + .last_level_seek_filtered + .inc_by(value); + } + TickerType::LastLevelSeekFilterMatch => { + STORE_ENGINE_BLOOM_EFFICIENCY + .get(name_enum) + .last_level_seek_filter_match + .inc_by(value); + } + TickerType::NonLastLevelSeekFiltered => { + STORE_ENGINE_BLOOM_EFFICIENCY + .get(name_enum) + .non_last_level_seek_filtered + .inc_by(value); + } + TickerType::NonLastLevelSeekFilterMatch => { + STORE_ENGINE_BLOOM_EFFICIENCY + .get(name_enum) + .non_last_level_seek_filter_match + .inc_by(value); + } TickerType::MemtableHit => { STORE_ENGINE_MEMTABLE_EFFICIENCY .get(name_enum) diff --git a/components/engine_rocks/src/rocks_metrics_defs.rs b/components/engine_rocks/src/rocks_metrics_defs.rs index 2b70ff985c5..1796886d7b9 100644 --- a/components/engine_rocks/src/rocks_metrics_defs.rs +++ b/components/engine_rocks/src/rocks_metrics_defs.rs @@ -110,6 +110,10 @@ pub const ENGINE_TICKER_TYPES: &[TickerType] = &[ TickerType::FlushWriteBytes, TickerType::ReadAmpEstimateUsefulBytes, TickerType::ReadAmpTotalReadBytes, + TickerType::LastLevelSeekFiltered, + TickerType::LastLevelSeekFilterMatch, + TickerType::NonLastLevelSeekFiltered, + TickerType::NonLastLevelSeekFilterMatch, ]; pub const TITAN_ENGINE_TICKER_TYPES: &[TickerType] = &[ diff --git a/metrics/grafana/tikv_details.dashboard.py b/metrics/grafana/tikv_details.dashboard.py index d88b01f6ec2..88d4d09a5e0 100644 --- a/metrics/grafana/tikv_details.dashboard.py +++ b/metrics/grafana/tikv_details.dashboard.py @@ -5999,22 +5999,66 @@ def RocksDB() -> RowPanel: ), target( expr=expr_operator( - expr_sum_rate( - "tikv_engine_bloom_efficiency", - label_selectors=[ - 'db="$db"', - 'type="bloom_prefix_useful"', - ], - by_labels=[], # override default by instance. + expr_operator( + expr_sum_rate( + "tikv_engine_bloom_efficiency", + label_selectors=[ + 'db="$db"', + 'type="last_level_seek_filtered"', + ], + by_labels=[], # override default by instance. + ), + "+", + expr_sum_rate( + "tikv_engine_bloom_efficiency", + label_selectors=[ + 'db="$db"', + 'type="non_last_level_seek_filtered"', + ], + by_labels=[], # override default by instance. + ), ), "/", - expr_sum_rate( - "tikv_engine_bloom_efficiency", - label_selectors=[ - 'db="$db"', - 'type="bloom_prefix_checked"', - ], - by_labels=[], # override default by instance. + expr_operator( + expr_operator( + expr_sum_rate( + "tikv_engine_bloom_efficiency", + label_selectors=[ + 'db="$db"', + 'type="last_level_seek_filtered"', + ], + by_labels=[], # override default by instance. + ), + "+", + expr_sum_rate( + "tikv_engine_bloom_efficiency", + label_selectors=[ + 'db="$db"', + 'type="non_last_level_seek_filtered"', + ], + by_labels=[], # override default by instance. + ), + ), + "+", + expr_operator( + expr_sum_rate( + "tikv_engine_bloom_efficiency", + label_selectors=[ + 'db="$db"', + 'type="last_level_seek_filter_match"', + ], + by_labels=[], # override default by instance. + ), + "+", + expr_sum_rate( + "tikv_engine_bloom_efficiency", + label_selectors=[ + 'db="$db"', + 'type="non_last_level_seek_filter_match"', + ], + by_labels=[], # override default by instance. + ), + ), ), ), legend_format="bloom prefix", diff --git a/metrics/grafana/tikv_details.json b/metrics/grafana/tikv_details.json index c18f536ec8d..17b1984f098 100644 --- a/metrics/grafana/tikv_details.json +++ b/metrics/grafana/tikv_details.json @@ -31034,7 +31034,7 @@ }, { "datasource": "${DS_TEST-CLUSTER}", - "expr": "(sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"bloom_prefix_useful\"}\n [$__rate_interval]\n)) by ($additional_groupby) / sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"bloom_prefix_checked\"}\n [$__rate_interval]\n)) by ($additional_groupby) )", + "expr": "((sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"last_level_seek_filtered\"}\n [$__rate_interval]\n)) by ($additional_groupby) + sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"non_last_level_seek_filtered\"}\n [$__rate_interval]\n)) by ($additional_groupby) ) / ((sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"last_level_seek_filtered\"}\n [$__rate_interval]\n)) by ($additional_groupby) + sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"non_last_level_seek_filtered\"}\n [$__rate_interval]\n)) by ($additional_groupby) ) + (sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"last_level_seek_filter_match\"}\n [$__rate_interval]\n)) by ($additional_groupby) + sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"non_last_level_seek_filter_match\"}\n [$__rate_interval]\n)) by ($additional_groupby) )))", "format": "time_series", "hide": false, "instant": false, @@ -31042,7 +31042,7 @@ "intervalFactor": 1, "legendFormat": "bloom prefix {{$additional_groupby}}", "metric": "", - "query": "(sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"bloom_prefix_useful\"}\n [$__rate_interval]\n)) by ($additional_groupby) / sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"bloom_prefix_checked\"}\n [$__rate_interval]\n)) by ($additional_groupby) )", + "query": "((sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"last_level_seek_filtered\"}\n [$__rate_interval]\n)) by ($additional_groupby) + sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"non_last_level_seek_filtered\"}\n [$__rate_interval]\n)) by ($additional_groupby) ) / ((sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"last_level_seek_filtered\"}\n [$__rate_interval]\n)) by ($additional_groupby) + sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"non_last_level_seek_filtered\"}\n [$__rate_interval]\n)) by ($additional_groupby) ) + (sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"last_level_seek_filter_match\"}\n [$__rate_interval]\n)) by ($additional_groupby) + sum(rate(\n tikv_engine_bloom_efficiency\n {k8s_cluster=\"$k8s_cluster\",tidb_cluster=\"$tidb_cluster\",instance=~\"$instance\",db=\"$db\",type=\"non_last_level_seek_filter_match\"}\n [$__rate_interval]\n)) by ($additional_groupby) )))", "refId": "", "step": 10, "target": "" diff --git a/metrics/grafana/tikv_details.json.sha256 b/metrics/grafana/tikv_details.json.sha256 index b0964023cd3..33425b3b570 100644 --- a/metrics/grafana/tikv_details.json.sha256 +++ b/metrics/grafana/tikv_details.json.sha256 @@ -1 +1 @@ -6a3c9238ffc0450c013981946f4388ced4a92759b379f0b2289b1cbdfc7a1b48 ./metrics/grafana/tikv_details.json +857f7b413acdc5cafdcb68bf40ec6184d6c30ad0a4bc8a351431d8f25d552752 ./metrics/grafana/tikv_details.json