Skip to content
Merged
17 changes: 9 additions & 8 deletions operations/alloy-mixin/dashboards/alloy-logs.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local filename = 'alloy-logs.json';
'{%s}' % baseLabels,

local lokiTemplateVariables =
if $._config.enableK8sCluster then [
if $._config.enableK8sCluster then ([
{
name: 'cluster',
label: 'Cluster',
Expand All @@ -26,7 +26,7 @@ local filename = 'alloy-logs.json';
refresh: 2,
sort: 1,
multi: true,
includeAll: false,
allowCustomValue: true,
},
Comment thread
thampiotr marked this conversation as resolved.
{
name: 'namespace',
Expand All @@ -37,7 +37,7 @@ local filename = 'alloy-logs.json';
refresh: 2,
sort: 1,
multi: true,
includeAll: false,
allowCustomValue: true,
},
{
name: 'job',
Expand Down Expand Up @@ -93,8 +93,8 @@ local filename = 'alloy-logs.json';
},
],
},
]
else [
])
else ([
{
name: 'job',
label: 'Job',
Expand All @@ -104,7 +104,8 @@ local filename = 'alloy-logs.json';
refresh: 2,
sort: 1,
multi: true,
includeAll: false,
includeAll: true,
allValue: '.*',
},
{
name: 'instance',
Expand Down Expand Up @@ -148,7 +149,7 @@ local filename = 'alloy-logs.json';
},
],
},
],
]),

grafanaDashboards+::
if $._config.enableLokiLogs then {
Expand Down Expand Up @@ -176,7 +177,7 @@ local filename = 'alloy-logs.json';
uid: '${loki_datasource}',
},
expr: 'sum by (level) (count_over_time(%s\n|~ "$regex_search"\n\n[$__auto]))\n' % logsSelector,
legendFormat: '{{ level }}',
legendFormat: '{{level}}',
},
]) +
{
Expand Down
14 changes: 10 additions & 4 deletions operations/alloy-mixin/dashboards/cluster-node.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ local filename = 'alloy-cluster-node.json';
filterSelector=$._config.filterSelector,
enableK8sCluster=$._config.enableK8sCluster,
includeInstance=true,
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels),
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels
) + [
dashboard.newGroupByTemplateVariable(
query='event,state,instance,job,namespace,cluster,pod',
defaultValue='event'
),
],

[filename]:
dashboard.new(name='Alloy / Cluster Node', tag=$._config.dashboardTag) +
Expand All @@ -22,7 +28,7 @@ local filename = 'alloy-cluster-node.json';
dashboard.withTemplateVariablesMixin(templateVariables) +
// TODO(@tpaschalis) Make the annotation optional.
dashboard.withAnnotations([
dashboard.newLokiAnnotation('Deployments', '{cluster="$cluster", container="kube-diff-logger"} | json | namespace_extracted="alloy" | name_extracted=~"alloy.*"', 'rgba(0, 211, 255, 1)'),
dashboard.newLokiAnnotation('Deployments', '{cluster=~"$cluster", container="kube-diff-logger"} | json | namespace_extracted="alloy" | name_extracted=~"alloy.*"', 'rgba(0, 211, 255, 1)'),
]) +
dashboard.withPanelsMixin([
// Node Info row
Expand Down Expand Up @@ -107,9 +113,9 @@ local filename = 'alloy-cluster-node.json';
panel.withQueries([
panel.newQuery(
expr= |||
rate(cluster_node_gossip_received_events_total{%(instanceSelector)s}[$__rate_interval])
sum by(${groupby}) (rate(cluster_node_gossip_received_events_total{%(instanceSelector)s}[$__rate_interval]))
||| % $._config,
legendFormat='{{event}}'
legendFormat='__auto'
),
])
),
Expand Down
14 changes: 10 additions & 4 deletions operations/alloy-mixin/dashboards/cluster-overview.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ local cluster_node_filename = 'alloy-cluster-node.json';
filterSelector=$._config.filterSelector,
enableK8sCluster=$._config.enableK8sCluster,
includeInstance=false,
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels),
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels
) + [
dashboard.newGroupByTemplateVariable(
query='instance,state,job,namespace,cluster,pod',
defaultValue='instance'
),
],

local minClusterSizeLineStyle = [
{
Expand Down Expand Up @@ -48,7 +54,7 @@ local cluster_node_filename = 'alloy-cluster-node.json';
dashboard.withTemplateVariablesMixin(templateVariables) +
// TODO(@tpaschalis) Make the annotation optional.
dashboard.withAnnotations([
dashboard.newLokiAnnotation('Deployments', '{cluster="$cluster", container="kube-diff-logger"} | json | namespace_extracted="alloy" | name_extracted=~"alloy.*"', 'rgba(0, 211, 255, 1)'),
dashboard.newLokiAnnotation('Deployments', '{cluster=~"$cluster", container="kube-diff-logger"} | json | namespace_extracted="alloy" | name_extracted=~"alloy.*"', 'rgba(0, 211, 255, 1)'),
]) +
dashboard.withPanelsMixin([
// Nodes
Expand Down Expand Up @@ -271,9 +277,9 @@ local cluster_node_filename = 'alloy-cluster-node.json';
panel.withQueries([
panel.newQuery(
expr= |||
sum by(instance) (cluster_node_peers{%(groupSelector)s})
sum by(${groupby}) (cluster_node_peers{%(groupSelector)s})
||| % $._config,
legendFormat='{{instance}}',
legendFormat='__auto',
),
panel.newQuery(
expr= |||
Expand Down
12 changes: 9 additions & 3 deletions operations/alloy-mixin/dashboards/controller.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ local filename = 'alloy-controller.json';
filterSelector=$._config.filterSelector,
enableK8sCluster=$._config.enableK8sCluster,
includeInstance=false,
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels),
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels
) + [
dashboard.newGroupByTemplateVariable(
query='instance,component_path,component_id,controller_path,health_type,job,namespace,cluster,pod',
defaultValue='instance'
),
],

[filename]:
dashboard.new(name='Alloy / Controller', tag=$._config.dashboardTag) +
Expand All @@ -22,7 +28,7 @@ local filename = 'alloy-controller.json';
dashboard.withTemplateVariablesMixin(templateVariables) +
// TODO(@tpaschalis) Make the annotation optional.
dashboard.withAnnotations([
dashboard.newLokiAnnotation('Deployments', '{cluster="$cluster", container="kube-diff-logger"} | json | namespace_extracted="alloy" | name_extracted=~"alloy.*"', 'rgba(0, 211, 255, 1)'),
dashboard.newLokiAnnotation('Deployments', '{cluster=~"$cluster", container="kube-diff-logger"} | json | namespace_extracted="alloy" | name_extracted=~"alloy.*"', 'rgba(0, 211, 255, 1)'),
]) +
dashboard.withPanelsMixin([
// Running instances
Expand Down Expand Up @@ -208,7 +214,7 @@ local filename = 'alloy-controller.json';
panel.withQueries([
panel.newQuery(
expr= |||
sum by (instance) (rate(alloy_component_evaluation_seconds_count{%(groupSelector)s}[$__rate_interval]))
sum by (${groupby}) (rate(alloy_component_evaluation_seconds_count{%(groupSelector)s}[$__rate_interval]))
||| % $._config,
),
])
Expand Down
41 changes: 23 additions & 18 deletions operations/alloy-mixin/dashboards/loki.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local filename = 'alloy-loki.json';
panel.withQueries([
panel.newQuery(
expr=|||
sum by(instance) (loki_source_file_files_active_total{%(instanceSelector)s})
sum by(${groupby}) (loki_source_file_files_active_total{%(instanceSelector)s})
||| % $._config,
),
])
Expand All @@ -38,7 +38,7 @@ local filename = 'alloy-loki.json';
panel.withQueries([
panel.newQuery(
expr=|||
sum by (instance) (rate(loki_source_file_read_lines_total{%(instanceSelector)s}[$__rate_interval]))
sum by (${groupby}) (rate(loki_source_file_read_lines_total{%(instanceSelector)s}[$__rate_interval]))
||| % $._config,
),
])
Expand All @@ -60,7 +60,7 @@ local filename = 'alloy-loki.json';
panel.withQueries([
panel.newQuery(
expr=|||
sum by (instance) (rate(loki_source_journal_target_lines_total{%(instanceSelector)s}[$__rate_interval]))
sum by (${groupby}) (rate(loki_source_journal_target_lines_total{%(instanceSelector)s}[$__rate_interval]))
||| % $._config,
),
])
Expand All @@ -82,9 +82,9 @@ local filename = 'alloy-loki.json';
panel.withQueries([
panel.newQuery(
expr=|||
sum by(instance) (rate(loki_write_request_duration_seconds_bucket{%(instanceSelector)s, status_code=~"2..", host=~"$url"}[$__rate_interval]))
sum by(${groupby}) (rate(loki_write_request_duration_seconds_bucket{%(instanceSelector)s, status_code=~"2..", host=~"$url"}[$__rate_interval]))
/
sum by(instance) (rate(loki_write_request_duration_seconds_bucket{%(instanceSelector)s, host=~"$url"}[$__rate_interval])) * 100
sum by(${groupby}) (rate(loki_write_request_duration_seconds_bucket{%(instanceSelector)s, host=~"$url"}[$__rate_interval])) * 100
||| % $._config,
),
])
Expand All @@ -103,34 +103,34 @@ local filename = 'alloy-loki.json';
expr=|||
histogram_quantile(
0.99,
sum by (le, instance) (
sum by (le, ${groupby}) (
rate(loki_write_request_duration_seconds_bucket{%(instanceSelector)s, host=~"$url"}[$__rate_interval])
)
)
||| % $._config,
legendFormat='{{instance}} p99'
legendFormat='{{${groupby}}} p99'
),
Comment thread
thampiotr marked this conversation as resolved.
panel.newQuery(
expr=|||
histogram_quantile(
0.95,
sum by (le, instance) (
sum by (le, ${groupby}) (
rate(loki_write_request_duration_seconds_bucket{%(instanceSelector)s, host=~"$url"}[$__rate_interval])
)
)
||| % $._config,
legendFormat='{{instance}} p95'
legendFormat='{{${groupby}}} p95'
),
panel.newQuery(
expr=|||
histogram_quantile(
0.50,
sum by (le, instance) (
sum by (le, ${groupby}) (
rate(loki_write_request_duration_seconds_bucket{%(instanceSelector)s, host=~"$url"}[$__rate_interval])
)
)
||| % $._config,
legendFormat='{{instance}} p50'
legendFormat='{{${groupby}}} p50'
),
])
),
Expand All @@ -147,7 +147,7 @@ local filename = 'alloy-loki.json';
panel.withQueries([
panel.newQuery(
expr=|||
sum by (instance) (rate(loki_write_sent_bytes_total{%(instanceSelector)s, host=~"$url"}[$__rate_interval]))
sum by (${groupby}) (rate(loki_write_sent_bytes_total{%(instanceSelector)s, host=~"$url"}[$__rate_interval]))
||| % $._config,
),
])
Expand All @@ -165,7 +165,7 @@ local filename = 'alloy-loki.json';
panel.withQueries([
panel.newQuery(
expr=|||
sum by(instance) (rate(loki_write_dropped_bytes_total{%(instanceSelector)s, host=~"$url"}[$__rate_interval]))
sum by(${groupby}) (rate(loki_write_dropped_bytes_total{%(instanceSelector)s, host=~"$url"}[$__rate_interval]))
||| % $._config,
),
])
Expand All @@ -180,21 +180,21 @@ local filename = 'alloy-loki.json';
local k8sEndpointQuery =
if std.isEmpty($._config.filterSelector) then
|||
label_values(loki_write_sent_bytes_total{cluster=~"$cluster", namespace=~"$namespace", job="$job", instance=~"$instance"}, host)
label_values(loki_write_sent_bytes_total{cluster=~"$cluster", namespace=~"$namespace", job=~"$job", instance=~"$instance"}, host)
|||
else
|||
label_values(loki_write_sent_bytes_total{%(filterSelector)s, cluster=~"$cluster", namespace=~"$namespace", job="$job", instance=~"$instance"}, host)
label_values(loki_write_sent_bytes_total{%(filterSelector)s, cluster=~"$cluster", namespace=~"$namespace", job=~"$job", instance=~"$instance"}, host)
||| % $._config,

local endpointQuery =
if std.isEmpty($._config.filterSelector) then
|||
label_values(loki_write_sent_bytes_total{job="$job", instance=~"$instance"}, host)
label_values(loki_write_sent_bytes_total{job=~"$job", instance=~"$instance"}, host)
|||
else
|||
label_values(loki_write_sent_bytes_total{%(filterSelector)s, job="$job", instance=~"$instance"}, host)
label_values(loki_write_sent_bytes_total{%(filterSelector)s, job=~"$job", instance=~"$instance"}, host)
||| % $._config,

local lokiTemplateVariables =
Expand All @@ -221,7 +221,12 @@ local filename = 'alloy-loki.json';
enableK8sCluster=$._config.enableK8sCluster,
includeInstance=true,
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels
) + lokiTemplateVariables,
) + lokiTemplateVariables + [
dashboard.newGroupByTemplateVariable(
query='instance,host,status_code,job,namespace,cluster,pod',
defaultValue='instance'
),
],

[filename]:
dashboard.new(name='Alloy / Loki Components', tag=$._config.dashboardTag) +
Expand Down
Loading
Loading