Skip to content

Commit

Permalink
Refactoring: simplified dashboards resources and networking panels ut…
Browse files Browse the repository at this point in the history
…ilities (grafana#3531) (grafana#3578)

Signed-off-by: Marco Pracucci <marco@pracucci.com>

Signed-off-by: Marco Pracucci <marco@pracucci.com>
(cherry picked from commit b0a390b)

Co-authored-by: Marco Pracucci <marco@pracucci.com>
  • Loading branch information
2 people authored and mason committed Dec 16, 2022
1 parent bcd167e commit b9c6afb
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 111 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* [ENHANCEMENT] Dashboards: Add read path insights row to the "Mimir / Tenants" dashboard. #3326
* [ENHANCEMENT] Alerts: Add runbook urls for alerts. #3452
* [ENHANCEMENT] Configuration: Make it possible to configure namespace label, job label, and job prefix. #3482
* [ENHANCEMENT] Dashboards: improved resources and networking dashboards to work with read-write deployment mode too. #3497 #3504 #3519
* [ENHANCEMENT] Dashboards: improved resources and networking dashboards to work with read-write deployment mode too. #3497 #3504 #3519 #3531
* [BUGFIX] Dashboards: Fix legend showing `persistentvolumeclaim` when using `deployment_type=baremetal` for `Disk space utilization` panels. #3173
* [BUGFIX] Alerts: Fixed `MimirGossipMembersMismatch` alert when Mimir is deployed in read-write mode. #3489
* [BUGFIX] Dashboards: Remove "Inflight requests" from object store panels because the panel is not tracking the inflight requests to object storage. #3521
Expand Down
28 changes: 14 additions & 14 deletions operations/mimir-mixin/dashboards/alertmanager-resources.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,62 @@ local filename = 'mimir-alertmanager-resources.json';
$._config.gateway_enabled,
$.row('Gateway')
.addPanel(
$.containerCPUUsagePanel($._config.instance_names.gateway, $._config.container_names.gateway),
$.containerCPUUsagePanelByComponent('gateway'),
)
.addPanel(
$.containerMemoryWorkingSetPanel($._config.instance_names.gateway, $._config.container_names.gateway),
$.containerMemoryWorkingSetPanelByComponent('gateway'),
)
.addPanel(
$.containerGoHeapInUsePanel($._config.instance_names.gateway, $._config.container_names.gateway),
$.containerGoHeapInUsePanelByComponent('gateway'),
)
)
.addRow(
$.row('Alertmanager')
.addPanel(
$.containerCPUUsagePanel($._config.instance_names.alertmanager, $._config.container_names.alertmanager),
$.containerCPUUsagePanelByComponent('alertmanager'),
)
.addPanel(
$.containerMemoryWorkingSetPanel($._config.instance_names.alertmanager, $._config.container_names.alertmanager),
$.containerMemoryWorkingSetPanelByComponent('alertmanager'),
)
.addPanel(
$.containerGoHeapInUsePanel($._config.instance_names.alertmanager, $._config.container_names.alertmanager),
$.containerGoHeapInUsePanelByComponent('alertmanager'),
)
)
.addRowIf(
$._config.alertmanager_im_enabled,
$.row('Instance mapper')
.addPanel(
$.containerCPUUsagePanel($._config.instance_names.alertmanager_im, $._config.container_names.alertmanager_im),
$.containerCPUUsagePanelByComponent('alertmanager_im'),
)
.addPanel(
$.containerMemoryWorkingSetPanel($._config.instance_names.alertmanager_im, $._config.container_names.alertmanager_im),
$.containerMemoryWorkingSetPanelByComponent('alertmanager_im'),
)
.addPanel(
$.containerGoHeapInUsePanel($._config.instance_names.alertmanager_im, $._config.container_names.alertmanager_im),
$.containerGoHeapInUsePanelByComponent('alertmanager_im'),
)
)
.addRow(
$.row('Network')
.addPanel(
$.containerNetworkReceiveBytesPanel($._config.instance_names.alertmanager),
$.containerNetworkReceiveBytesPanelByComponent('alertmanager'),
)
.addPanel(
$.containerNetworkTransmitBytesPanel($._config.instance_names.alertmanager),
$.containerNetworkTransmitBytesPanelByComponent('alertmanager'),
)
)
.addRow(
$.row('Disk')
.addPanel(
$.containerDiskWritesPanel($._config.instance_names.alertmanager, $._config.container_names.alertmanager),
$.containerDiskWritesPanelByComponent('alertmanager'),
)
.addPanel(
$.containerDiskReadsPanel($._config.instance_names.alertmanager, $._config.container_names.alertmanager),
$.containerDiskReadsPanelByComponent('alertmanager'),
)
)
.addRow(
$.row('')
.addPanel(
$.containerDiskSpaceUtilization($._config.instance_names.alertmanager, $._config.container_names.alertmanager),
$.containerDiskSpaceUtilizationPanelByComponent('alertmanager'),
)
),
}
18 changes: 9 additions & 9 deletions operations/mimir-mixin/dashboards/compactor-resources.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@ local filename = 'mimir-compactor-resources.json';
.addRow(
$.row('CPU and memory')
.addPanel(
$.containerCPUUsagePanel($._config.instance_names.compactor, $._config.container_names.compactor),
$.containerCPUUsagePanelByComponent('compactor'),
)
.addPanel(
$.containerGoHeapInUsePanel($._config.instance_names.compactor, $._config.container_names.compactor),
$.containerGoHeapInUsePanelByComponent('compactor'),
)
)
.addRow(
$.row('')
.addPanel(
$.containerMemoryRSSPanel($._config.instance_names.compactor, $._config.container_names.compactor),
$.containerMemoryRSSPanelByComponent('compactor'),
)
.addPanel(
$.containerMemoryWorkingSetPanel($._config.instance_names.compactor, $._config.container_names.compactor),
$.containerMemoryWorkingSetPanelByComponent('compactor'),
)
)
.addRow(
$.row('Network')
.addPanel(
$.containerNetworkReceiveBytesPanel($._config.instance_names.compactor),
$.containerNetworkReceiveBytesPanelByComponent('compactor'),
)
.addPanel(
$.containerNetworkTransmitBytesPanel($._config.instance_names.compactor),
$.containerNetworkTransmitBytesPanelByComponent('compactor'),
)
)
.addRow(
$.row('Disk')
.addPanel(
$.containerDiskWritesPanel($._config.instance_names.compactor, $._config.container_names.compactor),
$.containerDiskWritesPanelByComponent('compactor'),
)
.addPanel(
$.containerDiskReadsPanel($._config.instance_names.compactor, $._config.container_names.compactor),
$.containerDiskReadsPanelByComponent('compactor'),
)
.addPanel(
$.containerDiskSpaceUtilization($._config.instance_names.compactor, $._config.container_names.compactor),
$.containerDiskSpaceUtilizationPanelByComponent('compactor'),
)
) + {
templating+: {
Expand Down
48 changes: 38 additions & 10 deletions operations/mimir-mixin/dashboards/dashboard-utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
fill: 0,
},

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerCPUUsagePanelByComponent(componentName)::
$.containerCPUUsagePanel($._config.instance_names[componentName], $._config.container_names[componentName]),

// The provided instanceName should be a regexp from $._config.instance_names, while
// the provided containerName should be a regexp from $._config.container_names.
containerMemoryWorkingSetPanel(instanceName, containerName)::
Expand All @@ -312,6 +316,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
fill: 0,
},

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerMemoryWorkingSetPanelByComponent(componentName)::
$.containerMemoryWorkingSetPanel($._config.instance_names[componentName], $._config.container_names[componentName]),

// The provided instanceName should be a regexp from $._config.instance_names, while
// the provided containerName should be a regexp from $._config.container_names.
containerMemoryRSSPanel(instanceName, containerName)::
Expand All @@ -327,6 +335,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
fill: 0,
},

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerMemoryRSSPanelByComponent(componentName)::
$.containerMemoryRSSPanel($._config.instance_names[componentName], $._config.container_names[componentName]),

// The provided instanceName should be a regexp from $._config.instance_names, while
// the provided containerName should be a regexp from $._config.container_names.
containerGoHeapInUsePanel(instanceName, containerName)::
Expand All @@ -338,6 +350,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
fill: 0,
},

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerGoHeapInUsePanelByComponent(componentName)::
$.containerGoHeapInUsePanel($._config.instance_names[componentName], $._config.container_names[componentName]),

containerNetworkBytesPanel(title, metric, instanceName)::
$.panel(title) +
$.queryPanel(
Expand All @@ -350,13 +366,13 @@ local utils = import 'mixin-utils/utils.libsonnet';
$.stack +
{ yaxes: $.yaxes('Bps') },

// The provided instanceName should be a regexp from $._config.instance_names.
containerNetworkReceiveBytesPanel(instanceName)::
$.containerNetworkBytesPanel('Receive bandwidth', 'network_receive_bytes', instanceName),
// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerNetworkReceiveBytesPanelByComponent(componentName)::
$.containerNetworkBytesPanel('Receive bandwidth', 'network_receive_bytes', $._config.instance_names[componentName]),

// The provided instanceName should be a regexp from $._config.instance_names.
containerNetworkTransmitBytesPanel(instanceName)::
$.containerNetworkBytesPanel('Transmit bandwidth', 'network_transmit_bytes', instanceName),
// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerNetworkTransmitBytesPanelByComponent(componentName)::
$.containerNetworkBytesPanel('Transmit bandwidth', 'network_transmit_bytes', $._config.instance_names[componentName]),

// The provided instanceName should be a regexp from $._config.instance_names, while
// the provided containerName should be a regexp from $._config.container_names.
Expand All @@ -375,6 +391,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
$.stack +
{ yaxes: $.yaxes('Bps') },

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerDiskWritesPanelByComponent(componentName)::
$.containerDiskWritesPanel($._config.instance_names[componentName], $._config.container_names[componentName]),

// The provided instanceName should be a regexp from $._config.instance_names, while
// the provided containerName should be a regexp from $._config.container_names.
containerDiskReadsPanel(instanceName, containerName)::
Expand All @@ -392,9 +412,13 @@ local utils = import 'mixin-utils/utils.libsonnet';
$.stack +
{ yaxes: $.yaxes('Bps') },

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerDiskReadsPanelByComponent(componentName)::
$.containerDiskReadsPanel($._config.instance_names[componentName], $._config.container_names[componentName]),

// The provided instanceName should be a regexp from $._config.instance_names, while
// the provided containerName should be a regexp from $._config.container_names.
containerDiskSpaceUtilization(instanceName, containerName)::
containerDiskSpaceUtilizationPanel(instanceName, containerName)::
local label = if $._config.deployment_type == 'kubernetes' then '{{persistentvolumeclaim}}' else '{{instance}}';

$.panel('Disk space utilization') +
Expand All @@ -412,13 +436,17 @@ local utils = import 'mixin-utils/utils.libsonnet';
fill: 0,
},

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerDiskSpaceUtilizationPanelByComponent(componentName)::
$.containerDiskSpaceUtilizationPanel($._config.instance_names[componentName], $._config.container_names[componentName]),

// The provided containerName should be a regexp from $._config.container_names.
containerLabelNameMatcher(containerName)::
// Check only the prefix so that a multi-zone deployment matches too.
'label_name=~"(%s).*"' % containerName,

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
containerNetworkingRow(title, componentName)::
containerNetworkingRowByComponent(title, componentName)::
// Match series using namespace + instance instead of the job so that we can
// select only specific deployments (e.g. "distributor in microservices mode").
local vars = $._config {
Expand All @@ -428,8 +456,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
};

super.row(title)
.addPanel($.containerNetworkReceiveBytesPanel($._config.instance_names[componentName]))
.addPanel($.containerNetworkTransmitBytesPanel($._config.instance_names[componentName]))
.addPanel($.containerNetworkReceiveBytesPanelByComponent(componentName))
.addPanel($.containerNetworkTransmitBytesPanelByComponent(componentName))
.addPanel(
$.panel('Inflight requests (per pod)') +
$.queryPanel([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ local filename = 'mimir-overview-networking.json';
[filename]:
($.dashboard('Overview networking') + { uid: std.md5(filename) })
.addClusterSelectorTemplates(false)
.addRowIf($._config.gateway_enabled, $.containerNetworkingRow('Gateway', 'gateway'))
.addRow($.containerNetworkingRow('Writes', 'write'))
.addRow($.containerNetworkingRow('Reads', 'read'))
.addRow($.containerNetworkingRow('Backend', 'backend'))
.addRowIf($._config.gateway_enabled, $.containerNetworkingRowByComponent('Gateway', 'gateway'))
.addRow($.containerNetworkingRowByComponent('Writes', 'write'))
.addRow($.containerNetworkingRowByComponent('Reads', 'read'))
.addRow($.containerNetworkingRowByComponent('Backend', 'backend'))
+ {
templating+: {
list: [
Expand Down
24 changes: 12 additions & 12 deletions operations/mimir-mixin/dashboards/overview-resources.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ local filename = 'mimir-overview-resources.json';
$._config.gateway_enabled,
$.row('Gateway')
.addPanel(
$.containerCPUUsagePanel($._config.instance_names.gateway, $._config.container_names.gateway),
$.containerCPUUsagePanelByComponent('gateway'),
)
.addPanel(
$.containerMemoryWorkingSetPanel($._config.instance_names.gateway, $._config.container_names.gateway),
$.containerMemoryWorkingSetPanelByComponent('gateway'),
)
.addPanel(
$.containerGoHeapInUsePanel($._config.instance_names.gateway, $._config.container_names.gateway),
$.containerGoHeapInUsePanelByComponent('gateway'),
)
)

Expand All @@ -33,19 +33,19 @@ local filename = 'mimir-overview-resources.json';
{ yaxes: $.yaxes('bytes') },
)
.addPanel(
$.containerGoHeapInUsePanel($._config.instance_names.write, $._config.container_names.write),
$.containerGoHeapInUsePanelByComponent('write'),
)
)
.addRow(
$.row('')
.addPanel(
$.containerDiskWritesPanel($._config.instance_names.write, $._config.container_names.write)
$.containerDiskWritesPanelByComponent('write')
)
.addPanel(
$.containerDiskReadsPanel($._config.instance_names.write, $._config.container_names.write)
$.containerDiskReadsPanelByComponent('write')
)
.addPanel(
$.containerDiskSpaceUtilization($._config.instance_names.write, $._config.container_names.write),
$.containerDiskSpaceUtilizationPanelByComponent('write'),
)
)

Expand All @@ -61,7 +61,7 @@ local filename = 'mimir-overview-resources.json';
{ yaxes: $.yaxes('bytes') },
)
.addPanel(
$.containerGoHeapInUsePanel($._config.instance_names.read, $._config.container_names.read),
$.containerGoHeapInUsePanelByComponent('read'),
)
)

Expand All @@ -77,19 +77,19 @@ local filename = 'mimir-overview-resources.json';
{ yaxes: $.yaxes('bytes') },
)
.addPanel(
$.containerGoHeapInUsePanel($._config.instance_names.backend, $._config.container_names.backend),
$.containerGoHeapInUsePanelByComponent('backend'),
)
)
.addRow(
$.row('')
.addPanel(
$.containerDiskWritesPanel($._config.instance_names.backend, $._config.container_names.backend)
$.containerDiskWritesPanelByComponent('backend')
)
.addPanel(
$.containerDiskReadsPanel($._config.instance_names.backend, $._config.container_names.backend)
$.containerDiskReadsPanelByComponent('backend')
)
.addPanel(
$.containerDiskSpaceUtilization($._config.instance_names.backend, $._config.container_names.backend),
$.containerDiskSpaceUtilizationPanelByComponent('backend'),
)
),
}
14 changes: 7 additions & 7 deletions operations/mimir-mixin/dashboards/reads-networking.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ local filename = 'mimir-reads-networking.json';
[filename]:
($.dashboard('Reads networking') + { uid: std.md5(filename) })
.addClusterSelectorTemplates(false)
.addRow($.containerNetworkingRow('Summary', 'read'))
.addRowIf($._config.gateway_enabled, $.containerNetworkingRow('Gateway', 'gateway'))
.addRow($.containerNetworkingRow('Query-frontend', 'query_frontend'))
.addRow($.containerNetworkingRow('Query-scheduler', 'query_scheduler'))
.addRow($.containerNetworkingRow('Querier', 'querier'))
.addRow($.containerNetworkingRow('Store-gateway', 'store_gateway'))
.addRow($.containerNetworkingRow('Ruler', 'ruler'))
.addRow($.containerNetworkingRowByComponent('Summary', 'read'))
.addRowIf($._config.gateway_enabled, $.containerNetworkingRowByComponent('Gateway', 'gateway'))
.addRow($.containerNetworkingRowByComponent('Query-frontend', 'query_frontend'))
.addRow($.containerNetworkingRowByComponent('Query-scheduler', 'query_scheduler'))
.addRow($.containerNetworkingRowByComponent('Querier', 'querier'))
.addRow($.containerNetworkingRowByComponent('Store-gateway', 'store_gateway'))
.addRow($.containerNetworkingRowByComponent('Ruler', 'ruler'))
+ {
templating+: {
list: [
Expand Down
Loading

0 comments on commit b9c6afb

Please sign in to comment.