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

grafana: Add gRPC Received commands rate panel #8921

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
220 changes: 220 additions & 0 deletions metrics/grafana/pd.json
Original file line number Diff line number Diff line change
Expand Up @@ -8937,6 +8937,226 @@
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"dashLength": 10,
"datasource": "${DS_TEST-CLUSTER}",
"description": "The rate of received each kind of gRPC commands",
"editable": true,
"fill": 1,
"grid": {},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 127
},
"id": 904,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"hideEmpty": true,
"hideZero": true,
"max": true,
"min": false,
"rightSide": true,
"show": true,
"sideWidth": 300,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"paceLength": 10,
"pointradius": 5,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"targets": [
{
"expr": "sum(rate(grpc_server_started_total{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}[1m])) by (instance, grpc_method)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about also adding the error rate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it. But btw, it can't catch the error hide in the header, like this

Header: wrapErrorToHeader(pdpb.ErrorType_REGION_NOT_FOUND,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment or raise an issue for further improvement.

"legendFormat": "{{instance}}-{{grpc_method}}",
"interval": "",
"exemplar": true,
"intervalFactor": 2,
"refId": "A",
"step": 4
}
],
"thresholds": [],
"timeRegions": [],
"title": "gRPC Received commands rate",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 10,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
},
"options": {
"alertThreshold": true
},
"fieldConfig": {
"defaults": {},
"overrides": []
},
"pluginVersion": "7.5.17",
"bars": false,
"dashes": false,
"decimals": null,
"error": false,
"percentage": false,
"points": false,
"stack": false,
"steppedLine": false,
"timeFrom": null,
"timeShift": null,
"fillGradient": 0,
"hiddenSeries": false
},
{
"aliasColors": {},
"dashLength": 10,
"datasource": "${DS_TEST-CLUSTER}",
"description": "The error rate of handled gRPC commands",
"editable": true,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 1,
"grid": {},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 135
},
"id": 905,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"hideEmpty": true,
"hideZero": true,
"max": true,
"min": false,
"rightSide": true,
"show": true,
"sideWidth": 300,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {
"alertThreshold": true
},
"paceLength": 10,
"pluginVersion": "7.5.17",
"pointradius": 5,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"targets": [
{
"expr": "sum(rate(grpc_server_handled_total{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\", grpc_type=\"unary\", grpc_code!=\"OK\"}[1m])) by (grpc_method)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding one expr as unary total about ignoring grpc_code?

Copy link
Member Author

@okJiang okJiang Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grpc_server_handled_total only records the count after handling. If we want to record the receive msg count, we can use grpc_server_msg_received_total, but it does not record grpc_code label. So we can't record the error rate of the stream, no grpc native metrics we can use. https://github.com/grpc-ecosystem/go-grpc-middleware/blob/66bb7d8818ff22b450b82111a1260ca6dfe3486c/providers/prometheus/server_metrics.go#L27-L53

"legendFormat": "{{grpc_method}}",
"interval": "",
"exemplar": true,
"intervalFactor": 2,
"refId": "A",
"step": 4
}
],
"thresholds": [],
"timeRegions": [],
"title": "gRPC Error rate",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 10,
"max": null,
"min": null,
"show": true,
"$$hashKey": "object:132"
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true,
"$$hashKey": "object:133"
}
],
"yaxis": {
"align": false,
"alignLevel": null
},
"bars": false,
"dashes": false,
"decimals": null,
"error": false,
"fillGradient": 0,
"hiddenSeries": false,
"percentage": false,
"points": false,
"stack": false,
"steppedLine": false,
"timeFrom": null,
"timeShift": null
}
],
"repeat": null,
Expand Down
Loading