Skip to content

Commit

Permalink
metrics: Correct bloom prefix efficiency monitoring (tikv#17872) (tik…
Browse files Browse the repository at this point in the history
…v#17900)

close tikv#17866

Update RocksDB bloom prefix seek efficiency monitoring

Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: Yang Zhang <[email protected]>

Co-authored-by: Yang Zhang <[email protected]>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 28, 2024
1 parent 9df0e73 commit eb66485
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 17 deletions.
28 changes: 28 additions & 0 deletions components/engine_rocks/src/rocks_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions components/engine_rocks/src/rocks_metrics_defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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] = &[
Expand Down
72 changes: 58 additions & 14 deletions metrics/grafana/tikv_details.dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions metrics/grafana/tikv_details.json
Original file line number Diff line number Diff line change
Expand Up @@ -31034,15 +31034,15 @@
},
{
"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,
"interval": "",
"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": ""
Expand Down
2 changes: 1 addition & 1 deletion metrics/grafana/tikv_details.json.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6a3c9238ffc0450c013981946f4388ced4a92759b379f0b2289b1cbdfc7a1b48 ./metrics/grafana/tikv_details.json
857f7b413acdc5cafdcb68bf40ec6184d6c30ad0a4bc8a351431d8f25d552752 ./metrics/grafana/tikv_details.json

0 comments on commit eb66485

Please sign in to comment.