Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tag/link fix to operational dashboard and promtail mixin dashboard. #4423

Merged
merged 1 commit into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions production/loki-mixin/dashboards/loki-operational.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
query:: 'loki',
},
{
name:: 'metrics',
name:: 'datasource',
type:: 'datasource',
query:: 'prometheus',
},
Expand All @@ -46,7 +46,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
variable:: 'cluster',
label:: cfg.clusterLabel,
query:: 'kube_pod_container_info{image=~".*loki.*", container!="loki-canary"}',
datasource:: '$metrics',
datasource:: '$datasource',
type:: 'query',
},
] else []
Expand All @@ -55,7 +55,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
variable:: 'namespace',
label:: 'namespace',
query:: cfg.namespaceQuery,
datasource:: '$metrics',
datasource:: '$datasource',
type:: cfg.namespaceType,
},
],
Expand Down Expand Up @@ -149,7 +149,7 @@ local utils = import 'mixin-utils/utils.libsonnet';

local selectDatasource(ds) =
if ds == null || ds == '' then ds
else if ds == '$datasource' then '$metrics'
else if ds == '$datasource' then '$datasource'
else '$logs',

panels: [
Expand Down Expand Up @@ -238,6 +238,22 @@ local utils = import 'mixin-utils/utils.libsonnet';
if l.type == 'query' || l.type == 'custom'
],
},
} + {
// ugly hack, copy pasta the tag/link
// code from the loki-mixin
tags: ['loki'],
links+: [
{
asDropdown: true,
icon: 'external link',
includeVars: true,
keepTime: true,
tags: $._config.tags,
targetBlank: false,
title: 'Loki Dashboards',
type: 'dashboards',
},
],
},
},
}
20 changes: 10 additions & 10 deletions production/promtail-mixin/dashboards.libsonnet
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
local g = import 'grafana-builder/grafana.libsonnet';
local utils = import 'mixin-utils/utils.libsonnet';
local loki_mixin_utils = import 'loki-mixin/dashboards/dashboard-utils.libsonnet';

{
grafanaDashboards+: {
local dashboard = (
loki_mixin_utils {
_config+:: { tags: ['loki'] },
}
),
local dashboards = self,

'promtail.json':{
Expand All @@ -16,14 +22,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
selector:: std.join(',', ['%(label)s%(op)s"%(value)s"' % matcher for matcher in (cfg.clusterMatchers + dashboards['promtail.json'].matchers)]),

templateLabels:: (
if cfg.showMultiCluster then [
{
variable:: 'cluster',
label:: cfg.clusterLabel,
query:: 'kube_pod_container_info{image=~".*promtail.*"}',
},
] else []
) + [
[
{
variable:: 'namespace',
label:: 'namespace',
Expand All @@ -34,9 +33,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
label:: 'created_by_name',
query:: 'kube_pod_info{namespace="$namespace",pod=~"promtail.*"}',
},
],
]),
} +
g.dashboard('Loki / Promtail')
dashboard.dashboard('Loki / Promtail')
.addClusterSelectorTemplates(false)
.addRow(
g.row('Targets & Files')
.addPanel(
Expand Down