Skip to content

Commit

Permalink
Fix Cortex Service Scaling for Grafana 11
Browse files Browse the repository at this point in the history
Signed-off-by: Friedrich Gonzalez <[email protected]>
  • Loading branch information
friedrichg committed May 27, 2024
1 parent 410244b commit 3242d3d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ cortex-mixin.zip
cortex-mixin/out
cortex-mixin/vendor
/test-readme/
.vscode
38 changes: 38 additions & 0 deletions cortex-mixin/dashboards/dashboard-utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,42 @@ local utils = import 'mixin-utils/utils.libsonnet';
%s
||| % [title, description],
},

overrideHidden(name)::
{
matcher: {
id: 'byName',
options: name,
},
properties: [
{
id: 'custom.hidden',
value: true,
},
],
},

overrideDisplayName(name, displayName)::
{
matcher: {
id: 'byName',
options: name,
},
properties: [
{
id: 'displayName',
value: displayName,
},
],
},


tablePanel(queries, overrides)::
super.tablePanel(queries, {}) + {
fieldConfig+: {
overrides+: overrides,
},
styles:: null,
},

}
17 changes: 9 additions & 8 deletions cortex-mixin/dashboards/scaling.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ local utils = import 'mixin-utils/utils.libsonnet';
cluster_namespace_deployment:actual_replicas:count{cluster=~"$cluster", namespace=~"$namespace"}
)
|||,
], {
__name__: { alias: 'Cluster', type: 'hidden' },
cluster: { alias: 'Cluster' },
namespace: { alias: 'Namespace' },
deployment: { alias: 'Service' },
reason: { alias: 'Reason' },
Value: { alias: 'Required Replicas', decimals: 0 },
})
], [
$.overrideHidden('__name__'),
$.overrideHidden('Time'),
$.overrideDisplayName('cluster', 'Cluster'),
$.overrideDisplayName('namespace', 'Namespace'),
$.overrideDisplayName('deployment', 'Service'),
$.overrideDisplayName('reason', 'Reason'),
$.overrideDisplayName('Value', 'Required Replicas'),
])
)
),
}

0 comments on commit 3242d3d

Please sign in to comment.