Skip to content

Commit

Permalink
mixin: add tooltip with all series on Queries dashboard (#8179)
Browse files Browse the repository at this point in the history
* mixin: add tooltip with all series on Queries dashbaord

Before

After

This PR also adds a utility to make this easier.

Signed-off-by: Dimitar Dimitrov <[email protected]>

* Don't overwrite options

Signed-off-by: Dimitar Dimitrov <[email protected]>

* Update tests

Signed-off-by: Dimitar Dimitrov <[email protected]>

---------

Signed-off-by: Dimitar Dimitrov <[email protected]>
  • Loading branch information
dimitarvdimitrov authored May 29, 2024
1 parent 3803a60 commit 74628a9
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12724,8 +12724,8 @@ data:
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
"mode": "multi",
"sort": "desc"
}
},
"span": 4,
Expand Down Expand Up @@ -12772,8 +12772,8 @@ data:
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
"mode": "multi",
"sort": "desc"
}
},
"span": 4,
Expand Down Expand Up @@ -26210,7 +26210,7 @@ data:
"stacking": "none",
"tooltip": {
"mode": "multi",
"sort": "none"
"sort": "desc"
},
"xField": "Workload",
"xTickLabelRotation": 0,
Expand Down Expand Up @@ -34459,7 +34459,7 @@ data:
},
"tooltip": {
"mode": "multi",
"sort": "none"
"sort": "desc"
}
},
"span": 6,
Expand Down Expand Up @@ -37814,7 +37814,7 @@ data:
"showLegend": true
},
"tooltip": {
"mode": "single",
"mode": "multi",
"sort": "desc"
}
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions operations/mimir-mixin-compiled/dashboards/mimir-queries.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 16 additions & 29 deletions operations/mimir-mixin/dashboards/dashboard-utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,15 @@ local utils = import 'mixin-utils/utils.libsonnet';
// shows all values on tooltip, descending. Also turns on exemplars, unless 4th parameter is false.
hiddenLegendQueryPanel(queries, legends, legendLink=null, exemplars=true)::
$.queryPanel(queries, legends, legendLink) +
$.showAllTooltip +
{
options: {
options+: {
legend+: {
showLegend: false,
// Work round Grafana turning showLegend back on when we have
// schemaVersion<37. https://github.com/grafana/grafana/issues/54472
displayMode: 'hidden',
},
tooltip+: {
mode: 'multi',
sort: 'desc',
},
},
fieldConfig+: {
defaults+: {
Expand Down Expand Up @@ -335,6 +332,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
containerCPUUsagePanel(instanceName, containerName)::
$.timeseriesPanel('CPU') +
$.queryPanel($.resourceUtilizationAndLimitQueries('cpu', instanceName, containerName), $.resourceUtilizationAndLimitLegend('{{%s}}' % $._config.per_instance_label)) +
$.showAllTooltip +
{
fieldConfig+: {
overrides+: [
Expand All @@ -348,12 +346,6 @@ local utils = import 'mixin-utils/utils.libsonnet';
},
},
},
options+: {
tooltip: {
mode: 'multi',
sort: 'desc',
},
},
},

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
Expand All @@ -365,6 +357,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
containerMemoryWorkingSetPanel(instanceName, containerName)::
$.timeseriesPanel('Memory (workingset)') +
$.queryPanel($.resourceUtilizationAndLimitQueries('memory_working', instanceName, containerName), $.resourceUtilizationAndLimitLegend('{{%s}}' % $._config.per_instance_label)) +
$.showAllTooltip +
{
fieldConfig+: {
overrides+: [
Expand All @@ -378,12 +371,6 @@ local utils = import 'mixin-utils/utils.libsonnet';
},
},
},
options+: {
tooltip: {
mode: 'multi',
sort: 'desc',
},
},
},

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
Expand All @@ -395,6 +382,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
containerMemoryRSSPanel(instanceName, containerName)::
$.timeseriesPanel('Memory (RSS)') +
$.queryPanel($.resourceUtilizationAndLimitQueries('memory_rss', instanceName, containerName), $.resourceUtilizationAndLimitLegend('{{%s}}' % $._config.per_instance_label)) +
$.showAllTooltip +
{
fieldConfig+: {
overrides+: [
Expand All @@ -408,12 +396,6 @@ local utils = import 'mixin-utils/utils.libsonnet';
},
},
},
options+: {
tooltip: {
mode: 'multi',
sort: 'desc',
},
},
},

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
Expand All @@ -425,6 +407,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
containerGoHeapInUsePanel(instanceName, containerName)::
$.timeseriesPanel('Memory (go heap inuse)') +
$.queryPanel($.resourceUtilizationQuery('memory_go_heap', instanceName, containerName), '{{%s}}' % $._config.per_instance_label) +
$.showAllTooltip +
{
fieldConfig+: {
defaults+: {
Expand All @@ -434,12 +417,6 @@ local utils = import 'mixin-utils/utils.libsonnet';
},
},
},
options+: {
tooltip: {
mode: 'multi',
sort: 'desc',
},
},
},

// The provided componentName should be the name of a component among the ones defined in $._config.instance_names.
Expand Down Expand Up @@ -937,6 +914,16 @@ local utils = import 'mixin-utils/utils.libsonnet';
},
},

// Shows all series' values in the tooltip and sorts them in descending order.
showAllTooltip:: {
options+: {
tooltip+: {
mode: 'multi',
sort: 'desc',
},
},
},

// Switches a panel from lines (default) to bars.
bars:: {
fieldConfig+: {
Expand Down
2 changes: 2 additions & 0 deletions operations/mimir-mixin/dashboards/queries.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ local filename = 'mimir-queries.json';
'{{stage}}'
) +
$.stack +
$.showAllTooltip +
{ fieldConfig+: { defaults+: { unit: 's' } } },
)
.addPanel(
Expand All @@ -431,6 +432,7 @@ local filename = 'mimir-queries.json';
'{{stage}}'
) +
$.stack +
$.showAllTooltip +
{ fieldConfig+: { defaults+: { unit: 's' } } },
)
.addPanel(
Expand Down
4 changes: 1 addition & 3 deletions operations/mimir-mixin/dashboards/rollout-progress.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ local filename = 'mimir-rollout-progress.json';
min=0,
max=1
) +
$.showAllTooltip +
{
id: 1,
gridPos: { h: 13, w: 10, x: 0, y: 0 },
Expand All @@ -123,9 +124,6 @@ local filename = 'mimir-rollout-progress.json';
options+: {
xField: 'Workload',
orientation: 'horizontal',
tooltip+: {
mode: 'multi',
},
},
transformations: [
{
Expand Down
18 changes: 4 additions & 14 deletions operations/mimir-mixin/dashboards/tenants.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ local filename = 'mimir-tenants.json';
'{{pod}}',
],
) +
$.showAllTooltip +
{
fieldConfig+: {
defaults+: { custom+: { fillOpacity: 0 } },
Expand All @@ -107,10 +108,6 @@ local filename = 'mimir-tenants.json';
],
},
options+: {
tooltip+: {
mode: 'multi',
sort: 'desc',
},
legend+: { showLegend: false },
},
} +
Expand Down Expand Up @@ -144,6 +141,7 @@ local filename = 'mimir-tenants.json';
'{{pod}}',
],
) +
$.showAllTooltip +
{
fieldConfig+: {
defaults+: { custom+: { fillOpacity: 0 } },
Expand All @@ -155,10 +153,6 @@ local filename = 'mimir-tenants.json';
],
},
options+: {
tooltip+: {
mode: 'multi',
sort: 'desc',
},
legend+: { showLegend: false },
},
} +
Expand Down Expand Up @@ -762,7 +756,8 @@ local filename = 'mimir-tenants.json';
(sum(rate(cortex_bucket_index_estimated_compaction_jobs_errors_total{%s}[$__rate_interval])) == 0)
||| % [$.jobMatcher($._config.job_names.compactor), $.jobMatcher($._config.job_names.compactor)],
'{{ job }}',
) + {
) +
$.showAllTooltip + {
fieldConfig+: {
defaults+: {
custom+: {
Expand All @@ -771,11 +766,6 @@ local filename = 'mimir-tenants.json';
},
},
},
options+: {
tooltip+: {
mode: 'multi',
},
},
} +
$.panelDescription(
'Estimated Compaction Jobs',
Expand Down
4 changes: 1 addition & 3 deletions operations/mimir-mixin/dashboards/writes-resources.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ local filename = 'mimir-writes-resources.json';
'sum by(%s) (cortex_ingester_memory_series{%s})' % [$._config.per_instance_label, $.jobMatcher($._config.job_names.ingester)],
'{{%s}}' % $._config.per_instance_label
) +
$.showAllTooltip +
{
options+: {
tooltip+: { sort: 'desc' },
},
fieldConfig+: {
defaults+: {
custom+: {
Expand Down

0 comments on commit 74628a9

Please sign in to comment.