Skip to content

Commit

Permalink
Add another variable to pick the name of the promtail pod, we don't a…
Browse files Browse the repository at this point in the history
…lways deploy promtail with the same name and sometimes put more than one deployment in a namespace

Signed-off-by: Edward Welch <edward.welch@grafana.com>
  • Loading branch information
slim-bean committed Feb 28, 2020
1 parent d42859c commit 5cf1dc5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions production/promtail-mixin/dashboards.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ local utils = import 'mixin-utils/utils.libsonnet';
g.dashboard('Loki / Promtail')
.addTemplate('cluster', 'kube_pod_container_info{image=~".*promtail.*"}', 'cluster')
.addTemplate('namespace', 'kube_pod_container_info{image=~".*promtail.*"}', 'namespace')
.addTemplate('name', 'kube_pod_info{namespace="$namespace",pod=~"promtail.*"}', 'created_by_name')
.addRow(
g.row('Targets & Files')
.addPanel(
g.panel('Active Targets') +
g.queryPanel(
'sum(promtail_targets_active_total{cluster="$cluster", job="$namespace/promtail"})',
'sum(promtail_targets_active_total{cluster="$cluster", job="$namespace/$name"})',
'Active Targets',
),
)
.addPanel(
g.panel('Active Files') +
g.queryPanel(
'sum(promtail_files_active_total{cluster="$cluster", job="$namespace/promtail"})',
'sum(promtail_files_active_total{cluster="$cluster", job="$namespace/$name"})',
'Active Targets',
),
)
Expand All @@ -29,15 +30,15 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addPanel(
g.panel('Bps') +
g.queryPanel(
'sum(rate(promtail_read_bytes_total{cluster="$cluster", job="$namespace/promtail"}[1m]))',
'sum(rate(promtail_read_bytes_total{cluster="$cluster", job="$namespace/$name"}[1m]))',
'logs read',
) +
{ yaxes: g.yaxes('Bps') },
)
.addPanel(
g.panel('Lines') +
g.queryPanel(
'sum(rate(promtail_read_lines_total{cluster="$cluster", job="$namespace/promtail"}[1m]))',
'sum(rate(promtail_read_lines_total{cluster="$cluster", job="$namespace/$name"}[1m]))',
'lines read',
),
)
Expand All @@ -46,11 +47,11 @@ local utils = import 'mixin-utils/utils.libsonnet';
g.row('Requests')
.addPanel(
g.panel('QPS') +
g.qpsPanel('promtail_request_duration_seconds_count{cluster="$cluster", job="$namespace/promtail"}')
g.qpsPanel('promtail_request_duration_seconds_count{cluster="$cluster", job="$namespace/$name"}')
)
.addPanel(
g.panel('Latency') +
utils.latencyRecordingRulePanel('promtail_request_duration_seconds', [utils.selector.eq('job', '$namespace/promtail')], extra_selectors=[utils.selector.eq('cluster', '$cluster')])
utils.latencyRecordingRulePanel('promtail_request_duration_seconds', [utils.selector.eq('job', '$namespace/$name')], extra_selectors=[utils.selector.eq('cluster', '$cluster')])
)
),
},
Expand Down

0 comments on commit 5cf1dc5

Please sign in to comment.