Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions production/loki-mixin/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
115 changes: 57 additions & 58 deletions production/loki-mixin/dashboards/loki-bloom-compactor.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
}
115 changes: 57 additions & 58 deletions production/loki-mixin/dashboards/loki-bloom-gateway.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
}