Skip to content

Commit

Permalink
Merge pull request #301 from grafana/jdb/parameterize-ring-member-sel…
Browse files Browse the repository at this point in the history
…ector

feat: Allow configuration of ring members in gossip alerts
  • Loading branch information
simonswine authored Aug 31, 2021
2 parents bbbaa6f + c3d6055 commit dda3e68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cortex-mixin/alerts/alerts.libsonnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
// simpleRegexpOpt produces a simple regexp that matches all strings in the input array.
local simpleRegexpOpt(strings) =
assert std.isArray(strings) : 'simpleRegexpOpt requires that `strings` is an array of strings`';
'(' + std.join('|', strings) + ')',

groups+: [
{
name: 'cortex_alerts',
Expand Down Expand Up @@ -590,11 +595,12 @@
rules: [
{
alert: 'CortexGossipMembersMismatch',
expr: |||
memberlist_client_cluster_members_count
!= on (%s) group_left
sum by (%s) (up{job=~".+/(admin-api|compactor|store-gateway|distributor|ingester.*|querier.*|cortex|ruler)"})
||| % [$._config.alert_aggregation_labels, $._config.alert_aggregation_labels],
expr:
|||
memberlist_client_cluster_members_count
!= on (%s) group_left
sum by (%s) (up{job=~".+/%s"})
||| % [$._config.alert_aggregation_labels, $._config.alert_aggregation_labels, simpleRegexpOpt($._config.job_names.ring_members)],
'for': '5m',
labels: {
severity: 'warning',
Expand Down
1 change: 1 addition & 0 deletions cortex-mixin/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
query_frontend: '(query-frontend.*|cortex$)', // Match also custom query-frontend deployments.
query_scheduler: 'query-scheduler.*', // Not part of single-binary. Match also custom query-scheduler deployments.
table_manager: '(table-manager|cortex$)',
ring_members: ['compactor', 'distributor', 'ingester.*', 'querier.*', 'ruler', 'store-gateway', 'cortex'],
store_gateway: '(store-gateway|cortex$)',
gateway: '(gateway|cortex-gw|cortex-gw-internal)',
compactor: 'compactor.*', // Match also custom compactor deployments.
Expand Down

0 comments on commit dda3e68

Please sign in to comment.