Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics(hummock): add hummock version size metric #2348

Merged
merged 1 commit into from
May 6, 2022
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
122 changes: 108 additions & 14 deletions grafana/risingwave-dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 2,
"iteration": 1650019185521,
"iteration": 1651822117209,
"links": [],
"liveNow": true,
"panels": [
Expand Down Expand Up @@ -518,8 +518,8 @@
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"axisLabel": "KB",
"axisPlacement": "left",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
Expand Down Expand Up @@ -568,7 +568,7 @@
"x": 12,
"y": 18
},
"id": 168,
"id": 180,
"options": {
"legend": {
"calcs": [],
Expand All @@ -586,13 +586,22 @@
"uid": "PEDE6B306CC9C0CD0"
},
"exemplar": true,
"expr": "storage_level_compact_read_curr",
"expr": "version_size / 1024.0",
"instant": false,
"interval": "",
"legendFormat": "",
"legendFormat": "version size",
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "PEDE6B306CC9C0CD0"
},
"hide": false,
"refId": "B"
}
],
"title": "GBs read from current level",
"title": "Hummock Version Size",
"type": "timeseries"
},
{
Expand Down Expand Up @@ -738,7 +747,7 @@
"x": 12,
"y": 26
},
"id": 172,
"id": 168,
"options": {
"legend": {
"calcs": [],
Expand All @@ -756,13 +765,13 @@
"uid": "PEDE6B306CC9C0CD0"
},
"exemplar": true,
"expr": "storage_level_compact_write",
"expr": "storage_level_compact_read_curr",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"title": "GBs written to next level",
"title": "GBs read from current level",
"type": "timeseries"
},
{
Expand Down Expand Up @@ -908,7 +917,7 @@
"x": 12,
"y": 34
},
"id": 176,
"id": 172,
"options": {
"legend": {
"calcs": [],
Expand All @@ -926,13 +935,13 @@
"uid": "PEDE6B306CC9C0CD0"
},
"exemplar": true,
"expr": "storage_level_compact_read_sstn_next",
"expr": "storage_level_compact_write",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"title": "count of sst read from next level",
"title": "GBs written to next level",
"type": "timeseries"
},
{
Expand Down Expand Up @@ -1020,6 +1029,91 @@
"title": "count of sst written to next level",
"type": "timeseries"
},
{
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 42
},
"id": 176,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "PEDE6B306CC9C0CD0"
},
"exemplar": true,
"expr": "storage_level_compact_read_sstn_next",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"title": "count of sst read from next level",
"type": "timeseries"
},
{
"collapsed": false,
"gridPos": {
Expand Down Expand Up @@ -7647,6 +7741,6 @@
"timezone": "",
"title": "risingwave_dashboard",
"uid": "Ecy3uV1nz",
"version": 32,
"version": 33,
"weekStart": ""
}
4 changes: 4 additions & 0 deletions src/meta/src/hummock/metrics_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::time::{SystemTime, UNIX_EPOCH};

use itertools::enumerate;
use prometheus::core::{AtomicF64, AtomicU64, GenericCounter};
use prost::Message;
use risingwave_pb::hummock::{CompactMetrics, HummockVersion, TableSetStatistics};

use crate::hummock::compaction::CompactStatus;
Expand All @@ -31,6 +32,9 @@ pub fn trigger_commit_stat(metrics: &MetaMetrics, current_version: &HummockVersi
.iter()
.fold(0, |accum, elem| accum + elem.tables.len());
metrics.uncommitted_sst_num.set(uncommitted_sst_num as i64);
metrics
.version_size
.set(current_version.encoded_len() as i64);
}

pub fn trigger_sst_stat(
Expand Down
6 changes: 6 additions & 0 deletions src/meta/src/rpc/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub struct MetaMetrics {
pub level_compact_write_sstn: IntCounterVec,
/// num of compactions from each level to next level
pub level_compact_frequency: IntCounterVec,
/// hummock version size
pub version_size: IntGauge,
}

impl MetaMetrics {
Expand Down Expand Up @@ -163,6 +165,9 @@ impl MetaMetrics {
)
.unwrap();

let version_size =
register_int_gauge_with_registry!("version_size", "version size", registry).unwrap();

Self {
registry,

Expand All @@ -180,6 +185,7 @@ impl MetaMetrics {
level_compact_read_sstn_next,
level_compact_write_sstn,
level_compact_frequency,
version_size,
}
}

Expand Down