From b852d16be0cba95fdd3063f8084695c06eb27243 Mon Sep 17 00:00:00 2001 From: crazycs Date: Tue, 25 Jul 2023 22:39:03 +0800 Subject: [PATCH] *: update tikv/client-go and fix stale read metrics in grafana (#45530) close pingcap/tidb#45339 --- DEPS.bzl | 4 +- go.mod | 2 +- go.sum | 4 +- metrics/grafana/tidb.json | 147 +++++++++++++++++++++++++++++++++----- 4 files changed, 133 insertions(+), 24 deletions(-) diff --git a/DEPS.bzl b/DEPS.bzl index 0a187c55062df..06c38e21685f5 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -3696,8 +3696,8 @@ def go_deps(): name = "com_github_tikv_client_go_v2", build_file_proto_mode = "disable_global", importpath = "github.com/tikv/client-go/v2", - sum = "h1:jwRmcYsM0QeJcIRhnWfLhfNfwpiEAeQXioefEN6aBeI=", - version = "v2.0.4-0.20230628093657-7d0806ee6883", + sum = "h1:epuGF+KffiPTxWuuStzv63nIRV4PDedDwhIOLyTxrRQ=", + version = "v2.0.4-0.20230714024544-c7e214f2c32b", ) go_repository( name = "com_github_tikv_pd_client", diff --git a/go.mod b/go.mod index 3c0fb7c94bdff..57bda5cdd77a1 100644 --- a/go.mod +++ b/go.mod @@ -89,7 +89,7 @@ require ( github.com/stretchr/testify v1.8.0 github.com/tdakkota/asciicheck v0.1.1 github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 - github.com/tikv/client-go/v2 v2.0.4-0.20230628093657-7d0806ee6883 + github.com/tikv/client-go/v2 v2.0.4-0.20230714024544-c7e214f2c32b github.com/tikv/pd/client v0.0.0-20221031025758-80f0d8ca4d07 github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 github.com/twmb/murmur3 v1.1.3 diff --git a/go.sum b/go.sum index 03efc06927566..728f59eaf3726 100644 --- a/go.sum +++ b/go.sum @@ -933,8 +933,8 @@ github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpR github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJfDRtkanvQPiooDH8HvJ2FBh+iKT/OmiQQ= github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU= -github.com/tikv/client-go/v2 v2.0.4-0.20230628093657-7d0806ee6883 h1:jwRmcYsM0QeJcIRhnWfLhfNfwpiEAeQXioefEN6aBeI= -github.com/tikv/client-go/v2 v2.0.4-0.20230628093657-7d0806ee6883/go.mod h1:mmVCLP2OqWvQJPOIevQPZvGphzh/oq9vv8J5LDfpadQ= +github.com/tikv/client-go/v2 v2.0.4-0.20230714024544-c7e214f2c32b h1:epuGF+KffiPTxWuuStzv63nIRV4PDedDwhIOLyTxrRQ= +github.com/tikv/client-go/v2 v2.0.4-0.20230714024544-c7e214f2c32b/go.mod h1:mmVCLP2OqWvQJPOIevQPZvGphzh/oq9vv8J5LDfpadQ= github.com/tikv/pd/client v0.0.0-20221031025758-80f0d8ca4d07 h1:ckPpxKcl75mO2N6a4cJXiZH43hvcHPpqc9dh1TmH1nc= github.com/tikv/pd/client v0.0.0-20221031025758-80f0d8ca4d07/go.mod h1:CipBxPfxPUME+BImx9MUYXCnAVLS3VJUr3mnSJwh40A= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro= diff --git a/metrics/grafana/tidb.json b/metrics/grafana/tidb.json index f4c9428fe9563..78ab973f7277a 100644 --- a/metrics/grafana/tidb.json +++ b/metrics/grafana/tidb.json @@ -10016,18 +10016,20 @@ "h": 7, "w": 8, "x": 0, - "y": 50 + "y": 29 }, "hiddenSeries": false, "id": 306, "legend": { - "avg": false, - "current": false, - "max": false, + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, "min": false, + "rightSide": true, "show": true, "total": false, - "values": false + "values": true }, "lines": true, "linewidth": 1, @@ -10048,7 +10050,7 @@ "targets": [ { "exemplar": true, - "expr": "sum(rate(tidb_tikvclient_stale_read_bytes_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\", direction=\"in\"}[1m])) by (result)", + "expr": "sum(rate(tidb_tikvclient_stale_read_counter{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}[1m])) by (result)", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -10061,7 +10063,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Stale Read OPS", + "title": "Stale Read Hit/Miss OPS", "tooltip": { "shared": true, "sort": 0, @@ -10104,7 +10106,7 @@ "dashLength": 10, "dashes": false, "datasource": "${DS_TEST-CLUSTER}", - "description": "TiDB hit/miss stale-read traffic statistic", + "description": "TiDB stale-read requests count", "fieldConfig": { "defaults": {}, "overrides": [] @@ -10115,18 +10117,20 @@ "h": 7, "w": 8, "x": 8, - "y": 50 + "y": 29 }, "hiddenSeries": false, "id": 307, "legend": { - "avg": false, - "current": false, - "max": false, + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, "min": false, + "rightSide": true, "show": true, "total": false, - "values": false + "values": true }, "lines": true, "linewidth": 1, @@ -10147,8 +10151,113 @@ "targets": [ { "exemplar": true, - "expr": "sum(rate(tidb_tikvclient_stale_read_bytes_sum{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}[1m])) by (result, direction)", + "expr": "sum(rate(tidb_tikvclient_stale_read_req_counter{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}[1m])) by (type)", "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{type}}", + "refId": "A", + "step": 30 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Stale Read Req OPS", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:240", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "$$hashKey": "object:241", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_TEST-CLUSTER}", + "description": "TiDB stale-read requests traffic statistic", + "fieldConfig": { + "defaults": {}, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 29 + }, + "hiddenSeries": false, + "id": 308, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": false, + "rightSide": true, + "show": 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(rate(tidb_tikvclient_stale_read_bytes{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}[1m])) by (result, direction)", + "format": "time_series", + "hide": false, "interval": "", "intervalFactor": 2, "legendFormat": "{{result}}-{{direction}}", @@ -10160,7 +10269,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Stale Read Traffic", + "title": "Stale Read Req Traffic", "tooltip": { "shared": true, "sort": 0, @@ -10176,7 +10285,7 @@ }, "yaxes": [ { - "$$hashKey": "object:156", + "$$hashKey": "object:327", "format": "Bps", "label": null, "logBase": 1, @@ -10185,13 +10294,13 @@ "show": true }, { - "$$hashKey": "object:157", - "format": "short", + "$$hashKey": "object:328", + "format": "Bps", "label": null, "logBase": 1, "max": null, "min": null, - "show": false + "show": true } ], "yaxis": {