From: Aashish Sharma Date: Mon, 26 Feb 2024 09:32:19 +0000 (+0530) Subject: mgr/dashboard: replace piechart plugin charts with native pie chart X-Git-Tag: testing/wip-root-testing-20240411.174241~73^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0b058545d461a14976558eae1764210aa438cbc3;p=ceph-ci.git mgr/dashboard: replace piechart plugin charts with native pie chart panel Fixes: https://tracker.ceph.com/issues/64579 Signed-off-by: Aashish Sharma (cherry picked from commit 6e5efb626f4b3503a12371a8f609fdb5175a3ebe) --- diff --git a/monitoring/ceph-mixin/dashboards/osd.libsonnet b/monitoring/ceph-mixin/dashboards/osd.libsonnet index 259bb00d76f..9ac55613084 100644 --- a/monitoring/ceph-mixin/dashboards/osd.libsonnet +++ b/monitoring/ceph-mixin/dashboards/osd.libsonnet @@ -1,5 +1,6 @@ local g = import 'grafonnet/grafana.libsonnet'; + (import 'utils.libsonnet') { 'osds-overview.json': $.dashboardSchema( @@ -195,28 +196,18 @@ local g = import 'grafonnet/grafana.libsonnet'; true ) ) + { gridPos: { x: 20, y: 0, w: 4, h: 8 } }, - $.simplePieChart( - {}, '', 'OSD Types Summary' - ) + $.pieChartPanel('OSD Types Summary', '', '$datasource', { x: 0, y: 8, w: 4, h: 8 }, 'table', 'bottom', true, ['percent'], { mode: 'single', sort: 'none' }, 'pie', ['percent', 'value'], 'palette-classic') .addTarget( $.addTargetSchema('count by (device_class) (ceph_osd_metadata{%(matchers)s})' % $.matchers(), '{{device_class}}') - ) + { gridPos: { x: 0, y: 8, w: 4, h: 8 } }, - $.simplePieChart( - { 'Non-Encrypted': '#E5AC0E' }, '', 'OSD Objectstore Types' - ) - .addTarget( - $.addTargetSchema( - 'count(ceph_bluefs_wal_total_bytes{%(matchers)s})' % $.matchers(), 'bluestore', 'time_series', 2 - ) - ) - .addTarget( - $.addTargetSchema( - 'absent(ceph_bluefs_wal_total_bytes{%(matchers)s}) * count(ceph_osd_metadata{%(matchers)s})' % $.matchers(), 'filestore', 'time_series', 2 - ) - ) + { gridPos: { x: 4, y: 8, w: 4, h: 8 } }, - $.simplePieChart( - {}, 'The pie chart shows the various OSD sizes used within the cluster', 'OSD Size Summary' - ) + ), + $.pieChartPanel('OSD Objectstore Types', '', '$datasource', { x: 4, y: 8, w: 4, h: 8 }, 'table', 'bottom', true, ['percent'], { mode: 'single', sort: 'none' }, 'pie', ['percent', 'value'], 'palette-classic') + .addTarget($.addTargetSchema( + 'count(ceph_bluefs_wal_total_bytes{%(matchers)s})' % $.matchers(), 'bluestore', 'time_series', 2 + )) + .addTarget($.addTargetSchema( + 'absent(ceph_bluefs_wal_total_bytes{job=~"$job"}) * count(ceph_osd_metadata{job=~"$job"})' % $.matchers(), 'filestore', 'time_series', 2 + )), + $.pieChartPanel('OSD Size Summary', 'The pie chart shows the various OSD sizes used within the cluster', '$datasource', { x: 8, y: 8, w: 4, h: 8 }, 'table', 'bottom', true, ['percent'], { mode: 'single', sort: 'none' }, 'pie', ['percent', 'value'], 'palette-classic') .addTarget($.addTargetSchema( 'count(ceph_osd_stat_bytes{%(matchers)s} < 1099511627776)' % $.matchers(), '<1TB', 'time_series', 2 )) @@ -243,7 +234,7 @@ local g = import 'grafonnet/grafana.libsonnet'; )) .addTarget($.addTargetSchema( 'count(ceph_osd_stat_bytes{%(matchers)s} >= 13194139533312)' % $.matchers(), '<12TB+', 'time_series', 2 - )) + { gridPos: { x: 8, y: 8, w: 4, h: 8 } }, + )), g.graphPanel.new(bars=true, datasource='$datasource', title='Distribution of PGs per OSD', diff --git a/monitoring/ceph-mixin/dashboards/piechart_panel.libsonnet b/monitoring/ceph-mixin/dashboards/piechart_panel.libsonnet new file mode 100644 index 00000000000..abcf914d7a7 --- /dev/null +++ b/monitoring/ceph-mixin/dashboards/piechart_panel.libsonnet @@ -0,0 +1,70 @@ +{ + /** + * Creates a pie chart panel. + * + * @name pieChartPanel.new + * + * @param title The title of the pie chart panel. + * @param description (default `''`) Description of the panel + * @param datasource (optional) Datasource + * @param pieType (default `'pie'`) Type of pie chart (one of pie or donut) + * + * @method addTarget(target) Adds a target object. + */ + new( + title, + description='', + datasource=null, + gridPos={}, + displayMode='table', + placement='bottom', + showLegend=true, + displayLabels=[], + tooltip={}, + pieType='pie', + values=[], + colorMode='auto' + ):: { + type: 'piechart', + [if description != null then 'description']: description, + title: title, + gridPos: gridPos, + datasource: datasource, + options: { + legend: { + calcs: [], + values: values, + displayMode: displayMode, + placement: placement, + showLegend: showLegend, + }, + pieType: pieType, + tooltip: tooltip, + displayLabels: displayLabels, + }, + fieldConfig: { + defaults: { + color: { mode: colorMode }, + mappings: [], + custom: { + hideFrom: { + legend: false, + tooltip: false, + viz: false, + }, + }, + }, + overrides: [], + }, + targets: [ + ], + _nextTarget:: 0, + addTarget(target):: self { + // automatically ref id in added targets. + local nextTarget = super._nextTarget, + _nextTarget: nextTarget + 1, + targets+: [target { refId: std.char(std.codepoint('A') + nextTarget) }], + }, + addTargets(targets):: std.foldl(function(p, t) p.addTarget(t), targets, self), + }, +} diff --git a/monitoring/ceph-mixin/dashboards/utils.libsonnet b/monitoring/ceph-mixin/dashboards/utils.libsonnet index 397c00fe53a..57d971b0abe 100644 --- a/monitoring/ceph-mixin/dashboards/utils.libsonnet +++ b/monitoring/ceph-mixin/dashboards/utils.libsonnet @@ -1,4 +1,5 @@ local g = import 'grafonnet/grafana.libsonnet'; +local pieChartPanel = import 'piechart_panel.libsonnet'; local timeSeries = import 'timeseries_panel.libsonnet'; { @@ -646,6 +647,35 @@ local timeSeries = import 'timeseries_panel.libsonnet'; [if interval != null then 'interval']: interval, }, + pieChartPanel( + title, + description='', + datasource=null, + gridPos={}, + displayMode='table', + placement='bottom', + showLegend=true, + displayLabels=[], + tooltip={}, + pieType='pie', + values=[], + colorMode='auto' + ):: + pieChartPanel.new( + title, + description=description, + datasource=datasource, + gridPos=gridPos, + displayMode=displayMode, + placement=placement, + showLegend=showLegend, + displayLabels=displayLabels, + tooltip=tooltip, + pieType=pieType, + values=values, + colorMode=colorMode + ), + heatMapPanel( title='', datasource=null, diff --git a/monitoring/ceph-mixin/dashboards_out/osds-overview.json b/monitoring/ceph-mixin/dashboards_out/osds-overview.json index 79210f3cf2e..ecd05f827c4 100644 --- a/monitoring/ceph-mixin/dashboards_out/osds-overview.json +++ b/monitoring/ceph-mixin/dashboards_out/osds-overview.json @@ -442,9 +442,24 @@ "type": "table" }, { - "aliasColors": { }, "datasource": "$datasource", "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [ ] + }, + "overrides": [ ] + }, "gridPos": { "h": 8, "w": 4, @@ -452,13 +467,26 @@ "y": 8 }, "id": 6, - "legend": { - "percentage": true, - "show": true, - "values": true + "options": { + "displayLabels": [ + "percent" + ], + "legend": { + "calcs": [ ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "values": [ + "percent", + "value" + ] + }, + "pieType": "pie", + "tooltip": { + "mode": "single", + "sort": "none" + } }, - "legendType": "Under graph", - "pieType": "pie", "targets": [ { "expr": "count by (device_class) (ceph_osd_metadata{job=~\"$job\"})", @@ -469,15 +497,27 @@ } ], "title": "OSD Types Summary", - "type": "grafana-piechart-panel", - "valueName": "current" + "type": "piechart" }, { - "aliasColors": { - "Non-Encrypted": "#E5AC0E" - }, "datasource": "$datasource", "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [ ] + }, + "overrides": [ ] + }, "gridPos": { "h": 8, "w": 4, @@ -485,13 +525,26 @@ "y": 8 }, "id": 7, - "legend": { - "percentage": true, - "show": true, - "values": true + "options": { + "displayLabels": [ + "percent" + ], + "legend": { + "calcs": [ ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "values": [ + "percent", + "value" + ] + }, + "pieType": "pie", + "tooltip": { + "mode": "single", + "sort": "none" + } }, - "legendType": "Under graph", - "pieType": "pie", "targets": [ { "expr": "count(ceph_bluefs_wal_total_bytes{job=~\"$job\"})", @@ -509,13 +562,27 @@ } ], "title": "OSD Objectstore Types", - "type": "grafana-piechart-panel", - "valueName": "current" + "type": "piechart" }, { - "aliasColors": { }, "datasource": "$datasource", "description": "The pie chart shows the various OSD sizes used within the cluster", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [ ] + }, + "overrides": [ ] + }, "gridPos": { "h": 8, "w": 4, @@ -523,13 +590,26 @@ "y": 8 }, "id": 8, - "legend": { - "percentage": true, - "show": true, - "values": true + "options": { + "displayLabels": [ + "percent" + ], + "legend": { + "calcs": [ ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "values": [ + "percent", + "value" + ] + }, + "pieType": "pie", + "tooltip": { + "mode": "single", + "sort": "none" + } }, - "legendType": "Under graph", - "pieType": "pie", "targets": [ { "expr": "count(ceph_osd_stat_bytes{job=~\"$job\"} < 1099511627776)", @@ -596,8 +676,7 @@ } ], "title": "OSD Size Summary", - "type": "grafana-piechart-panel", - "valueName": "current" + "type": "piechart" }, { "aliasColors": { },