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

Mixin: Add alloy cluster label filters to dashboards #2018

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions operations/alloy-mixin/alerts/clustering.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local alert = import './utils/alert.jsonnet';
if enableK8sCluster then
'stddev by (cluster, namespace, job, cluster_name) (sum without (state) (cluster_node_peers)) != 0'
else
'stddev by (job) (sum without (state) (cluster_node_peers)) != 0',
'stddev by (job, cluster_name) (sum without (state) (cluster_node_peers)) != 0',
'Cluster is not converging.',
'Cluster is not converging: nodes report different number of peers in the cluster. Job is {{ $labels.job }}',
'10m',
Expand All @@ -29,8 +29,8 @@ local alert = import './utils/alert.jsonnet';
count by (cluster, namespace, job, cluster_name) (cluster_node_info)
||| else |||
sum without (state) (cluster_node_peers) !=
on (job) group_left
count by (job) (cluster_node_info)
on (job, cluster_name) group_left
count by (job, cluster_name) (cluster_node_info)
|||
,
'Nodes report different number of peers vs. the count of observed Alloy metrics.',
Expand All @@ -55,7 +55,7 @@ local alert = import './utils/alert.jsonnet';
if enableK8sCluster then
'sum by (cluster, namespace, job, cluster_name) (rate(cluster_node_gossip_received_events_total{event="node_conflict"}[2m])) > 0'
else
'sum by (job) (rate(cluster_node_gossip_received_events_total{event="node_conflict"}[2m])) > 0'
'sum by (job, cluster_name) (rate(cluster_node_gossip_received_events_total{event="node_conflict"}[2m])) > 0'
,
'Cluster Node Name Conflict.',
'A node tried to join the cluster with a name conflicting with an existing peer. Job is {{ $labels.job }}',
Expand All @@ -68,7 +68,7 @@ local alert = import './utils/alert.jsonnet';
if enableK8sCluster then
'sum by (cluster, namespace, job, instance, cluster_name) (cluster_node_peers{state="terminating"}) > 0'
else
'sum by (job, instance) (cluster_node_peers{state="terminating"}) > 0'
'sum by (job, instance, cluster_name) (cluster_node_peers{state="terminating"}) > 0'
,
'Cluster node stuck in Terminating state.',
'There is a node within the cluster that is stuck in Terminating state. Job is {{ $labels.job }}',
Expand All @@ -84,7 +84,7 @@ local alert = import './utils/alert.jsonnet';
) > 1
||| else |||
count without (sha256) (
max by (sha256, job) (alloy_config_hash and on(job) cluster_node_info)
max by (sha256, job, cluster_name) (alloy_config_hash and on(job) cluster_node_info)
) > 1
|||
,
Expand Down
2 changes: 1 addition & 1 deletion operations/alloy-mixin/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
enableLokiLogs: true,
filterSelector: '', #use it to filter specific metric label values, ie: job=~"integrations/alloy"
k8sClusterSelector: 'cluster=~"$cluster", namespace=~"$namespace"',
groupSelector: if self.enableK8sCluster then self.k8sClusterSelector + ', job=~"$job"' else 'job=~"$job"',
groupSelector: if self.enableK8sCluster then self.k8sClusterSelector + ', job=~"$job"' else 'job=~"$job"' + if self.enableAlloyCluster then ', cluster_name=~"$alloyCluster"' else '',
instanceSelector: self.groupSelector + ', instance=~"$instance"',
logsFilterSelector: '', #use to filter logs originated from alloy, and avoid picking up other platform logs, ie: service_name="alloy"
dashboardTag: 'alloy-mixin',
Expand Down
3 changes: 2 additions & 1 deletion operations/alloy-mixin/dashboards/cluster-node.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ local filename = 'alloy-cluster-node.json';
local templateVariables =
templates.newTemplateVariablesList(
filterSelector=$._config.filterSelector,
enableK8sCluster=$._config.enableK8sCluster,
enableK8sCluster=$._config.enableK8sCluster,
enableAlloyCluster=$._config.enableAlloyCluster,
includeInstance=true,
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ local cluster_node_filename = 'alloy-cluster-node.json';
local templateVariables =
templates.newTemplateVariablesList(
filterSelector=$._config.filterSelector,
enableK8sCluster=$._config.enableK8sCluster,
enableK8sCluster=$._config.enableK8sCluster,
enableAlloyCluster=$._config.enableAlloyCluster,
includeInstance=false,
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels),

Expand Down Expand Up @@ -63,6 +64,7 @@ local cluster_node_filename = 'alloy-cluster-node.json';
__name__: true,
cluster: true,
namespace: true,
cluster_name: true,
state: false,
},
indexByName: {},
Expand Down Expand Up @@ -102,7 +104,7 @@ local cluster_node_filename = 'alloy-cluster-node.json';
{
targetBlank: false,
title: 'Detail dashboard for node',
url: '/d/%(uid)s/alloy-cluster-node?var-instance=${__data.fields.instance}&var-datasource=${datasource}&var-loki_datasource=${loki_datasource}&var-job=${job}&var-cluster=${cluster}&var-namespace=${namespace}' % { uid: std.md5(cluster_node_filename) },
url: '/d/%(uid)s/alloy-cluster-node?var-instance=${__data.fields.instance}&var-datasource=${datasource}&var-loki_datasource=${loki_datasource}&var-job=${job}&var-cluster=${cluster}&var-namespace=${namespace}&var-alloyCluster=${alloyCluster}' % { uid: std.md5(cluster_node_filename) },
},
],
},
Expand Down
3 changes: 2 additions & 1 deletion operations/alloy-mixin/dashboards/controller.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ local filename = 'alloy-controller.json';
local templateVariables =
templates.newTemplateVariablesList(
filterSelector=$._config.filterSelector,
enableK8sCluster=$._config.enableK8sCluster,
enableK8sCluster=$._config.enableK8sCluster,
enableAlloyCluster=$._config.enableAlloyCluster,
includeInstance=false,
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels),

Expand Down
3 changes: 2 additions & 1 deletion operations/alloy-mixin/dashboards/opentelemetry.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ local stackedPanelMixin = {
local templateVariables =
templates.newTemplateVariablesList(
filterSelector=$._config.filterSelector,
enableK8sCluster=$._config.enableK8sCluster,
enableK8sCluster=$._config.enableK8sCluster,
enableAlloyCluster=$._config.enableAlloyCluster,
includeInstance=true,
setenceCaseLabels=$._config.useSetenceCaseTemplateLabels),

Expand Down
Loading
Loading