Skip to content

Commit

Permalink
chore: add mysql cl dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
kleyow committed Aug 5, 2023
1 parent c8b9c1c commit 566eb78
Show file tree
Hide file tree
Showing 4 changed files with 322 additions and 7 deletions.
1 change: 1 addition & 0 deletions docker-compose-monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ services:
env_file:
- ./docker/grafana/config.env
environment:
GF_SECURITY_DATA_SOURCE_PROXY_WHITELIST: mysql-cl:3306
GF_RENDERING_SERVER_URL: http://renderer:8081/render
GF_RENDERING_CALLBACK_URL: http://grafana:3000/
GF_LOG_FILTERS: rendering:debug
Expand Down
8 changes: 4 additions & 4 deletions docker-compose-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,10 @@ services:
condition: service_healthy
central-handler-position:
condition: service_healthy
central-handler-timeout:
condition: service_healthy
central-handler-get:
condition: service_healthy
# central-handler-timeout:
# condition: service_healthy
# central-handler-get:
# condition: service_healthy
central-handler-admin:
condition: service_healthy
networks:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 11,
"links": [
{
"asDropdown": false,
"icon": "external link",
"includeVars": false,
"keepTime": true,
"tags": [],
"targetBlank": true,
"title": "Image render",
"tooltip": "Image Render",
"type": "link",
"url": "/render/d/${__dashboard.uid}/${__dashboard}?height=1000&width=2000"
}
],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "mysql",
"uid": "e6f1763f-dc6a-4521-8254-0dbe1515b837"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "10.0.2",
"targets": [
{
"dataset": "central_ledger",
"datasource": {
"type": "mysql",
"uid": "e6f1763f-dc6a-4521-8254-0dbe1515b837"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT COUNT(transferId) FROM central_ledger.transferStateChange WHERE transferStateId = 'COMMITTED' AND createdDate between $__timeFrom() AND $__timeTo()",
"refId": "A",
"sql": {
"columns": [
{
"name": "COUNT",
"parameters": [
{
"name": "transferStateId",
"type": "functionParameter"
}
],
"type": "function"
}
],
"groupBy": [
{
"property": {
"name": "transferStateId",
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "transferStateChange"
}
],
"title": "COMMITED State Changes In DB between time range",
"type": "stat"
},
{
"datasource": {
"type": "mysql",
"uid": "e6f1763f-dc6a-4521-8254-0dbe1515b837"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 2,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "10.0.2",
"targets": [
{
"datasource": {
"type": "mysql",
"uid": "e6f1763f-dc6a-4521-8254-0dbe1515b837"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT COUNT(transferId) FROM central_ledger.transferStateChange WHERE transferStateId != 'COMMITTED' AND createdDate between $__timeFrom() AND $__timeTo()",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "Transfer state changes excluding COMMITTED between time range",
"type": "stat"
},
{
"datasource": {
"type": "mysql",
"uid": "e6f1763f-dc6a-4521-8254-0dbe1515b837"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"id": 3,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "10.0.2",
"targets": [
{
"dataset": "performance_schema",
"datasource": {
"type": "mysql",
"uid": "e6f1763f-dc6a-4521-8254-0dbe1515b837"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT table_schema \"DB Name\",\n ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) \"DB Size in MB\" \nFROM information_schema.tables \nGROUP BY table_schema; ",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "Panel Title",
"type": "table"
}
],
"refresh": "",
"schemaVersion": 38,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-3h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Central Ledger DB",
"uid": "d17cf1dd-8fbc-4841-a957-214387249f19",
"version": 5,
"weekStart": ""
}
3 changes: 0 additions & 3 deletions docker/sql-cl-init/01_permissions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ ALTER USER 'central_ledger'@'%' identified WITH mysql_native_password by 'passwo
CREATE USER 'exporter'@'%' IDENTIFIED BY 'password';
GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'exporter'@'%';
GRANT SELECT ON performance_schema.* TO 'exporter'@'%';
CREATE USER 'grafanaReader' IDENTIFIED BY 'password';
GRANT SELECT ON central_ledger.transferStateChange TO 'grafanaReader';
GRANT SELECT ON information_schema.TABLES TO 'grafanaReader';
FLUSH PRIVILEGES;

0 comments on commit 566eb78

Please sign in to comment.