Skip to content

Commit

Permalink
add grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
lidezhu committed Jun 8, 2023
1 parent 999b08d commit db8853a
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dbms/src/Common/CurrentMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
M(PSMVCCSnapshotsList) \
M(PSMVCCNumDelta) \
M(PSMVCCNumBase) \
M(PSWriterQueueSize) \
M(PSPendingWriterSize) \
M(RWLockWaitingReaders) \
M(RWLockWaitingWriters) \
M(RWLockActiveReaders) \
Expand Down
4 changes: 2 additions & 2 deletions dbms/src/Storages/Page/V3/PageDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
namespace CurrentMetrics
{
extern const Metric PSMVCCSnapshotsList;
extern const Metric PSWriterQueueSize;
extern const Metric PSPendingWriterSize;
} // namespace CurrentMetrics

namespace DB
Expand Down Expand Up @@ -1481,6 +1481,7 @@ std::unordered_set<String> PageDirectory<Trait>::apply(PageEntriesEdit && edit,
// Note that, as read threads use current `sequence` as read_seq, we cannot increase `sequence`
// before applying edit to `mvcc_table_directory`.
GET_METRIC(tiflash_storage_page_command_count, type_write).Increment();
CurrentMetrics::Increment pending_writer_size{CurrentMetrics::PSPendingWriterSize};
Writer w;
w.edit = &edit;

Expand All @@ -1492,7 +1493,6 @@ std::unordered_set<String> PageDirectory<Trait>::apply(PageEntriesEdit && edit,

writers.push_back(&w);
SYNC_FOR("after_PageDirectory::enter_write_group");
CurrentMetrics::set(CurrentMetrics::PSWriterQueueSize, writers.size());
w.cv.wait(apply_lock, [&] { return w.done || &w == writers.front(); });
GET_METRIC(tiflash_storage_page_write_duration_seconds, type_wait_in_group).Observe(watch.elapsedSeconds());
watch.restart();
Expand Down
230 changes: 221 additions & 9 deletions metrics/grafana/tiflash_summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,15 @@
"shared": true,
"sort": 2,
"value_type": "cumulative"
},
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
},
"yaxes": [
{
"format": "short",
Expand All @@ -620,8 +620,8 @@
"align": false,
"alignLevel": null
}
},
{
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
Expand All @@ -633,7 +633,7 @@
"fieldConfig": {
"defaults": {},
"overrides": []
},
},
"fill": 0,
"fillGradient": 0,
"grid": {},
Expand All @@ -642,7 +642,7 @@
"w": 12,
"x": 0,
"y": 17
},
},
"hiddenSeries": false,
"id": 51,
"legend": {
Expand All @@ -658,14 +658,14 @@
"sortDesc": true,
"total": false,
"values": true
},
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
},
"percentage": false,
"pluginVersion": "7.5.11",
"pointradius": 5,
Expand Down Expand Up @@ -8999,6 +8999,112 @@
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_TEST-CLUSTER}",
"description": "",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 137
},
"hiddenSeries": false,
"id": 232,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": true,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.5.11",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"yaxis": 2
}
],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "sum(increase(tiflash_storage_page_command_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}[1m])) by (instance, type)",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{type}}-{{instance}}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "PS Command OPS By Instance",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"decimals": null,
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "opm",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
Expand Down Expand Up @@ -9562,6 +9668,112 @@
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "test",
"description": "The num of pending writers in PageStorage",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 162
},
"hiddenSeries": false,
"id": 231,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"hideEmpty": false,
"hideZero": false,
"max": true,
"min": false,
"rightSide": true,
"show": true,
"sideWidth": 250,
"sort": "max",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.5.11",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "sum(tiflash_system_current_metric_PSPendingWriterSize{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}) by (instance)",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 1,
"legendFormat": "size-{{instance}}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "PageStorage Pending Writers Num",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "none",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": false
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"title": "PageStorage",
Expand Down Expand Up @@ -14859,4 +15071,4 @@
"title": "Test-Cluster-TiFlash-Summary",
"uid": "SVbh2xUWk",
"version": 1
}
}

0 comments on commit db8853a

Please sign in to comment.