feat: mixins / allow bloom dashboards disabling (#14177)

This PR allows hiding the bloom dashboards if they are not used.
pull/14178/head^2
Quentin Bisson 8 months ago committed by GitHub
parent a26416d078
commit ce2e6d520b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      production/loki-mixin/config.libsonnet
  2. 115
      production/loki-mixin/dashboards/loki-bloom-compactor.libsonnet
  3. 115
      production/loki-mixin/dashboards/loki-bloom-gateway.libsonnet

@ -15,6 +15,11 @@
// Enable dashboard and panels for Grafana Labs internal components.
internal_components: false,
blooms: {
// Whether or not to include blooms specific dashboards
enabled: true,
},
promtail: {
// Whether or not to include promtail specific dashboards
enabled: true,

@ -6,67 +6,66 @@ local raw = (import './dashboard-bloom-compactor.json');
// 2. Copy the JSON into `dashboard-bloom-compactor.json`
// 3. Delete the `id` and `templating` fields from the JSON
(import 'dashboard-utils.libsonnet') {
grafanaDashboards+:
{
'loki-bloom-compactor.json':
raw
{
local replaceClusterMatchers(expr) =
// Replace the recording rules cluster label with the per-cluster label
grafanaDashboards+:: if !$._config.blooms.enabled then {} else {
'loki-bloom-compactor.json':
raw
{
local replaceClusterMatchers(expr) =
// Replace the recording rules cluster label with the per-cluster label
std.strReplace(
// Replace the cluster label for equality matchers with the per-cluster label
std.strReplace(
// Replace the cluster label for equality matchers with the per-cluster label
// Replace the cluster label for regex matchers with the per-cluster label
std.strReplace(
// Replace the cluster label for regex matchers with the per-cluster label
std.strReplace(
expr,
'cluster=~"$cluster"',
$._config.per_cluster_label + '=~"$cluster"'
),
'cluster="$cluster"',
$._config.per_cluster_label + '="$cluster"'
expr,
'cluster=~"$cluster"',
$._config.per_cluster_label + '=~"$cluster"'
),
'cluster_job',
$._config.per_cluster_label + '_job'
'cluster="$cluster"',
$._config.per_cluster_label + '="$cluster"'
),
'cluster_job',
$._config.per_cluster_label + '_job'
),
panels: [
p {
targets: if std.objectHas(p, 'targets') then [
e {
expr: replaceClusterMatchers(e.expr),
}
for e in p.targets
] else [],
panels: if std.objectHas(p, 'panels') then [
sp {
targets: if std.objectHas(sp, 'targets') then [
spe {
expr: replaceClusterMatchers(spe.expr),
}
for spe in sp.targets
] else [],
panels: if std.objectHas(sp, 'panels') then [
ssp {
targets: if std.objectHas(ssp, 'targets') then [
sspe {
expr: replaceClusterMatchers(sspe.expr),
}
for sspe in ssp.targets
] else [],
}
for ssp in sp.panels
] else [],
}
for sp in p.panels
] else [],
}
for p in super.panels
],
}
+ $.dashboard('Loki / Bloom Compactor', uid='bloom-compactor')
.addCluster()
.addNamespace()
.addLog()
.addTag(),
},
panels: [
p {
targets: if std.objectHas(p, 'targets') then [
e {
expr: replaceClusterMatchers(e.expr),
}
for e in p.targets
] else [],
panels: if std.objectHas(p, 'panels') then [
sp {
targets: if std.objectHas(sp, 'targets') then [
spe {
expr: replaceClusterMatchers(spe.expr),
}
for spe in sp.targets
] else [],
panels: if std.objectHas(sp, 'panels') then [
ssp {
targets: if std.objectHas(ssp, 'targets') then [
sspe {
expr: replaceClusterMatchers(sspe.expr),
}
for sspe in ssp.targets
] else [],
}
for ssp in sp.panels
] else [],
}
for sp in p.panels
] else [],
}
for p in super.panels
],
}
+ $.dashboard('Loki / Bloom Compactor', uid='bloom-compactor')
.addCluster()
.addNamespace()
.addLog()
.addTag(),
},
}

@ -6,67 +6,66 @@ local raw = (import './dashboard-bloom-gateway.json');
// 2. Copy the JSON into `dashboard-bloom-gateway.json`
// 3. Delete the `id` and `templating` fields from the JSON
(import 'dashboard-utils.libsonnet') {
grafanaDashboards+:
{
'loki-bloom-gateway.json':
raw
{
local replaceClusterMatchers(expr) =
// Replace the recording rules cluster label with the per-cluster label
grafanaDashboards+:: if !$._config.blooms.enabled then {} else {
'loki-bloom-gateway.json':
raw
{
local replaceClusterMatchers(expr) =
// Replace the recording rules cluster label with the per-cluster label
std.strReplace(
// Replace the cluster label for equality matchers with the per-cluster label
std.strReplace(
// Replace the cluster label for equality matchers with the per-cluster label
// Replace the cluster label for regex matchers with the per-cluster label
std.strReplace(
// Replace the cluster label for regex matchers with the per-cluster label
std.strReplace(
expr,
'cluster=~"$cluster"',
$._config.per_cluster_label + '=~"$cluster"'
),
'cluster="$cluster"',
$._config.per_cluster_label + '="$cluster"'
expr,
'cluster=~"$cluster"',
$._config.per_cluster_label + '=~"$cluster"'
),
'cluster_job',
$._config.per_cluster_label + '_job'
'cluster="$cluster"',
$._config.per_cluster_label + '="$cluster"'
),
'cluster_job',
$._config.per_cluster_label + '_job'
),
panels: [
p {
targets: if std.objectHas(p, 'targets') then [
e {
expr: replaceClusterMatchers(e.expr),
}
for e in p.targets
] else [],
panels: if std.objectHas(p, 'panels') then [
sp {
targets: if std.objectHas(sp, 'targets') then [
spe {
expr: replaceClusterMatchers(spe.expr),
}
for spe in sp.targets
] else [],
panels: if std.objectHas(sp, 'panels') then [
ssp {
targets: if std.objectHas(ssp, 'targets') then [
sspe {
expr: replaceClusterMatchers(sspe.expr),
}
for sspe in ssp.targets
] else [],
}
for ssp in sp.panels
] else [],
}
for sp in p.panels
] else [],
}
for p in super.panels
],
}
+ $.dashboard('Loki / Bloom Gateway', uid='bloom-gateway')
.addCluster()
.addNamespace()
.addLog()
.addTag(),
},
panels: [
p {
targets: if std.objectHas(p, 'targets') then [
e {
expr: replaceClusterMatchers(e.expr),
}
for e in p.targets
] else [],
panels: if std.objectHas(p, 'panels') then [
sp {
targets: if std.objectHas(sp, 'targets') then [
spe {
expr: replaceClusterMatchers(spe.expr),
}
for spe in sp.targets
] else [],
panels: if std.objectHas(sp, 'panels') then [
ssp {
targets: if std.objectHas(ssp, 'targets') then [
sspe {
expr: replaceClusterMatchers(sspe.expr),
}
for sspe in ssp.targets
] else [],
}
for ssp in sp.panels
] else [],
}
for sp in p.panels
] else [],
}
for p in super.panels
],
}
+ $.dashboard('Loki / Bloom Gateway', uid='bloom-gateway')
.addCluster()
.addNamespace()
.addLog()
.addTag(),
},
}

Loading…
Cancel
Save