Skip to content

Commit 10982f4

Browse files
committed
dashboards: add dashboards_default_latency_mode config option to control the default value of the native/classic latency variable
1 parent 82aa921 commit 10982f4

13 files changed

+21
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182

183183
### Mixin
184184

185+
* [CHANGE] Dashboards: Add config option `dashboards_default_latency_mode` to control the default value of the native/classic latency variable (uses 'classic' if unset). #14423
185186
* [CHANGE] Alerts: Renamed the following alerts to fit within 40 characters: #13363
186187
* `MimirAlertmanagerPartialStateMergeFailing``MimirAlertmanagerStateMergeFailing`
187188
* `MimirServerInvalidClusterValidationLabelRequests``MimirServerInvalidClusterLabelRequests`

operations/mimir-mixin/dashboards/alertmanager.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ local filename = 'mimir-alertmanager.json';
99
assert std.md5(filename) == 'b0d38d318bbddd80476246d4930f9e55' : 'UID of the dashboard has changed, please update references to dashboard.';
1010
($.dashboard('Alertmanager') + { uid: std.md5(filename) })
1111
.addClusterSelectorTemplates()
12-
.addShowNativeLatencyVariable()
12+
.addShowNativeLatencyVariable($.latencyVariableDefault())
1313
.addRow(
1414
($.row('Headlines') + {
1515
height: '100px',

operations/mimir-mixin/dashboards/compactor.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ local fixTargetsForTransformations(panel, refIds) = panel {
8888
assert std.md5(filename) == '1b3443aea86db629e6efdb7d05c53823' : 'UID of the dashboard has changed, please update references to dashboard.';
8989
($.dashboard('Compactor') + { uid: std.md5(filename) })
9090
.addClusterSelectorTemplates()
91-
.addShowNativeLatencyVariable()
91+
.addShowNativeLatencyVariable($.latencyVariableDefault())
9292
.addRow(
9393
$.row('Summary')
9494
.addPanel(

operations/mimir-mixin/dashboards/dashboard-utils.libsonnet

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,4 +2242,12 @@ local utils = import 'mixin-utils/utils.libsonnet';
22422242
</p>
22432243
||| % querySchedulerDescription
22442244
),
2245+
2246+
// latencyVariableDefault returns the default to use for the native / classic latency variable.
2247+
// Use like: $._config.dashboards_default_latency_mode = 'native'.
2248+
latencyVariableDefault()::
2249+
if std.objectHas($._config, 'dashboards_default_latency_mode') then
2250+
$._config.dashboards_default_latency_mode
2251+
else
2252+
'classic',
22452253
}

operations/mimir-mixin/dashboards/object-store.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local filename = 'mimir-object-store.json';
66
assert std.md5(filename) == 'e1324ee2a434f4158c00a9ee279d3292' : 'UID of the dashboard has changed, please update references to dashboard.';
77
($.dashboard('Object Store') + { uid: std.md5(filename) })
88
.addClusterSelectorTemplates()
9-
.addShowNativeLatencyVariable()
9+
.addShowNativeLatencyVariable($.latencyVariableDefault())
1010
.addRow(
1111
$.row('Components')
1212
.addPanel(

operations/mimir-mixin/dashboards/overview.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ local filename = 'mimir-overview.json';
3333
assert std.md5(filename) == 'ffcd83628d7d4b5a03d1cafd159e6c9c' : 'UID of the dashboard has changed, please update references to dashboard.';
3434
($.dashboard('Overview') + { uid: std.md5(filename) })
3535
.addClusterSelectorTemplates()
36-
.addShowNativeLatencyVariable()
36+
.addShowNativeLatencyVariable($.latencyVariableDefault())
3737

3838
.addRow(
3939
$.row('%(product)s cluster health' % $._config)

operations/mimir-mixin/dashboards/queries.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ local filename = 'mimir-queries.json';
5555
assert std.md5(filename) == 'b3abe8d5c040395cc36615cb4334c92d' : 'UID of the dashboard has changed, please update references to dashboard.';
5656
($.dashboard('Queries') + { uid: std.md5(filename) })
5757
.addClusterSelectorTemplates()
58-
.addShowNativeLatencyVariable()
58+
.addShowNativeLatencyVariable($.latencyVariableDefault())
5959
// This selector allows to switch the read path components queried in this dashboard.
6060
// Since the labels matcher used by this selector is very wide (includes multiple components)
6161
// whenever you want to show panels for a specific component (e.g. query-frontend) you can safely

operations/mimir-mixin/dashboards/reads.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local filename = 'mimir-reads.json';
66
assert std.md5(filename) == 'e327503188913dc38ad571c647eef643' : 'UID of the dashboard has changed, please update references to dashboard.';
77
($.dashboard('Reads') + { uid: std.md5(filename) })
88
.addClusterSelectorTemplates()
9-
.addShowNativeLatencyVariable()
9+
.addShowNativeLatencyVariable($.latencyVariableDefault())
1010
.addRowIf(
1111
$._config.show_dashboard_descriptions.reads,
1212
($.row('Reads dashboard description') { height: '175px', showTitle: false })

operations/mimir-mixin/dashboards/remote-ruler-reads.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local filename = 'mimir-remote-ruler-reads.json';
77
assert std.md5(filename) == 'f103238f7f5ab2f1345ce650cbfbfe2f' : 'UID of the dashboard has changed, please update references to dashboard.';
88
($.dashboard('Remote ruler reads') + { uid: std.md5(filename) })
99
.addClusterSelectorTemplates()
10-
.addShowNativeLatencyVariable()
10+
.addShowNativeLatencyVariable($.latencyVariableDefault())
1111
.addRowIf(
1212
$._config.show_dashboard_descriptions.reads,
1313
($.row('Remote ruler reads dashboard description') { height: '175px', showTitle: false })

operations/mimir-mixin/dashboards/rollout-progress.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ local filename = 'mimir-rollout-progress.json';
2222
assert std.md5(filename) == '7f0b5567d543a1698e695b530eb7f5de' : 'UID of the dashboard has changed, please update references to dashboard.';
2323
($.dashboard('Rollout progress') + { uid: std.md5(filename) })
2424
.addClusterSelectorTemplates(false)
25-
.addShowNativeLatencyVariable() + {
25+
.addShowNativeLatencyVariable($.latencyVariableDefault()) + {
2626
// This dashboard uses the new grid system in order to place panels (using gridPos).
2727
// Because of this we can't use the mixin's addRow() and addPanel().
2828
schemaVersion: 27,

0 commit comments

Comments
 (0)