Skip to content

Commit

Permalink
Fix autoscaling dashboard (#1016)
Browse files Browse the repository at this point in the history
* Fixed autoscaling dashboards

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

* Fix

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

* Added PR number to CHANGELOG

Signed-off-by: Marco Pracucci <marco@pracucci.com>
  • Loading branch information
pracucci authored Feb 3, 2022
1 parent 95a9a06 commit 1f504dc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 35 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
* [CHANGE] Enabled resources dashboards by default. Can be disabled setting `resources_dashboards_enabled` config field to `false`. #920
* [FEATURE] Added `Cortex / Overrides` dashboard, displaying default limits and per-tenant overrides applied to Mimir. #673
* [FEATURE] Added `Mimir / Tenants` and `Mimir / Top tenants` dashboards, displaying user-based metrics. #776
* [FEATURE] Added querier autoscaling panels and alerts. #1006
* [FEATURE] Added querier autoscaling panels and alerts. #1006 #1016
* [ENHANCEMENT] cortex-mixin: Make `cluster_namespace_deployment:kube_pod_container_resource_requests_{cpu_cores,memory_bytes}:sum` backwards compatible with `kube-state-metrics` v2.0.0. [#317](https://github.com/grafana/cortex-jsonnet/pull/317)
* [ENHANCEMENT] Cortex-mixin: Include `cortex-gw-internal` naming variation in default `gateway` job names. [#328](https://github.com/grafana/cortex-jsonnet/pull/328)
* [ENHANCEMENT] Ruler dashboard: added object storage metrics. [#354](https://github.com/grafana/cortex-jsonnet/pull/354)
Expand Down
27 changes: 8 additions & 19 deletions operations/mimir-mixin-compiled/dashboards/mimir-reads.json
Original file line number Diff line number Diff line change
Expand Up @@ -1571,22 +1571,6 @@
"dashes": false,
"datasource": "$datasource",
"description": "### Scaling metric\nThis panel shows the result of the query used as scaling metric and target/threshold used.\nThe desired number of replicas is computed by HPA as: <scaling metric> / <target per replica>.\n\n",
"fieldConfig": {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Target per replica"
},
"properties": [
{
"id": "custom.axisPlacement",
"value": "right"
}
]
}
]
},
"fill": 1,
"id": 20,
"legend": {
Expand All @@ -1606,7 +1590,12 @@
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [ ],
"seriesOverrides": [
{
"alias": "Target per replica",
"yaxis": 2
}
],
"spaceLength": 10,
"span": 4,
"stack": false,
Expand Down Expand Up @@ -1663,7 +1652,7 @@
"logBase": 1,
"max": null,
"min": null,
"show": false
"show": true
}
]
},
Expand Down Expand Up @@ -1700,7 +1689,7 @@
"steppedLine": false,
"targets": [
{
"expr": "sum(rate(keda_metrics_adapter_scaler_errors[$__rate_interval])) +\non(metric) group_left\nlabel_replace(\n kube_horizontalpodautoscaler_spec_target_metric{cluster=~\"$cluster\", namespace=~\"$namespace\", horizontalpodautoscaler=\"keda-hpa-querier\"}\n * 0, \"metric\", \"$1\", \"metric_name\", \"(.+)\"\n)\n",
"expr": "sum by(metric) (rate(keda_metrics_adapter_scaler_errors[$__rate_interval])) +\non(metric) group_left\nlabel_replace(\n kube_horizontalpodautoscaler_spec_target_metric{cluster=~\"$cluster\", namespace=~\"$namespace\", horizontalpodautoscaler=\"keda-hpa-querier\"}\n * 0, \"metric\", \"$1\", \"metric_name\", \"(.+)\"\n)\n",
"format": "time_series",
"interval": "15s",
"intervalFactor": 2,
Expand Down
25 changes: 11 additions & 14 deletions operations/mimir-mixin/dashboards/dashboard-utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -575,24 +575,21 @@ local utils = import 'mixin-utils/utils.libsonnet';
namespace: $.namespaceMatcher(),
},

panelAxisPlacement(seriesName, placement):: {
fieldConfig+: {
overrides+: [
// panelAxisPlacement allows to place a series on the right axis.
// This function supports the old Graph panel.
panelAxisPlacement(seriesName, placement)::
if placement != 'right' then {} else {
seriesOverrides+: [
{
matcher: {
id: 'byName',
options: seriesName,
},
properties: [
{
id: 'custom.axisPlacement',
value: placement,
},
],
alias: seriesName,
yaxis: 2,
},
],
// Ensure all Y-axis are displayed (default is that right axis is hidden).
yaxes: std.map(function(entry) entry {
show: true,
}, super.yaxes),
},
},

panelDescription(title, description):: {
description: |||
Expand Down
2 changes: 1 addition & 1 deletion operations/mimir-mixin/dashboards/reads.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
local title = 'Autoscaler failures rate';
$.panel(title) +
$.queryPanel(
$.filterKedaMetricByHPA('sum(rate(keda_metrics_adapter_scaler_errors[$__rate_interval]))', $._config.autoscaling.querier_hpa_name),
$.filterKedaMetricByHPA('sum by(metric) (rate(keda_metrics_adapter_scaler_errors[$__rate_interval]))', $._config.autoscaling.querier_hpa_name),
'Failures per second'
) +
$.panelDescription(
Expand Down

0 comments on commit 1f504dc

Please sign in to comment.