Skip to content

Commit

Permalink
Remove confusing job!="" filteringSelector when no selector is requir…
Browse files Browse the repository at this point in the history
…ed. (#1370)

* Remove confusing job!="" filteringSelector when no selector is required.

* Update mixins

* Fix lint in jvm-mixin

* Fix windows alerts

* Fix kafka

* Fix trailing comma issue in logs lib when filteringSelector is ""
  • Loading branch information
v-zhuravlev authored Dec 11, 2024
1 parent 9162ba8 commit 43f9639
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 25 deletions.
17 changes: 6 additions & 11 deletions jvm-mixin/.lint
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
exclusions:
panel-title-description-rule:
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion"
panel-datasource-rule:
entries:
- panel: GC duration
- panel: Allocated/promoted
panel-units-rule:
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion"
template-datasource-rule:
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion"
template-instance-rule:
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion"
template-job-rule:
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion"
template-on-time-change-reload-rule:
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion"
entries:
- panel: Process files open
2 changes: 1 addition & 1 deletion jvm-mixin/config.libsonnet
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
filteringSelector: 'job!=""',
filteringSelector: '',
groupLabels: ['job'],
instanceLabels: ['instance'],
uid: 'jvm',
Expand Down
2 changes: 1 addition & 1 deletion jvm-observ-lib/config.libsonnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
local this = self,
filteringSelector: 'job!=""',
filteringSelector: '', // set to apply static filters to all queries and alerts, i.e. job="bar"
groupLabels: ['job'],
instanceLabels: ['instance'],
uid: 'jvm',
Expand Down
2 changes: 1 addition & 1 deletion kafka-observ-lib/config.libsonnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
local this = self,
filteringSelector: 'job!=""',
filteringSelector: '', // set to apply static filters to all queries and alerts, i.e. job="integrations/kafka"
zookeeperfilteringSelector: this.filteringSelector,
groupLabels: ['kafka_cluster'], // label(s) that defines kafka cluster
instanceLabels: ['instance'], // label(s) that defines single broker
Expand Down
2 changes: 1 addition & 1 deletion kafka-observ-lib/signals/consumerGroup.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local commonlib = import 'common-lib/common/main.libsonnet';

function(this)
{
filteringSelector: std.join(',', [this.filteringSelector, this.topicsFilteringSelector, this.consumerGroupFilteringSelector]),
filteringSelector: std.join(',', [this.topicsFilteringSelector, this.consumerGroupFilteringSelector, this.filteringSelector]),
groupLabels: this.groupLabels,
instanceLabels: ['topic', 'consumergroup'], // this.instanceLabels is ommitted, as it would point to kafka_exporter instance.
aggLevel: 'group',
Expand Down
2 changes: 1 addition & 1 deletion kafka-observ-lib/signals/topic.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local commonlib = import 'common-lib/common/main.libsonnet';

function(this)
{
filteringSelector: std.join(',', [this.filteringSelector, this.topicsFilteringSelector]),
filteringSelector: std.join(',', [this.topicsFilteringSelector, this.filteringSelector]),
groupLabels: this.groupLabels,
instanceLabels: ['topic'], // this.instanceLabels is ommitted, as it would point to kafka_exporter instance.
aggLevel: 'group',
Expand Down
2 changes: 1 addition & 1 deletion kafka-observ-lib/signals/totalTime.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local commonlib = import 'common-lib/common/main.libsonnet';
// TotalTimeMs metric
function(this)
{
filteringSelector: this.filteringSelector + ', quantile="%s"' % this.totalTimeMsQuantile,
filteringSelector: ('quantile="%s"' % this.totalTimeMsQuantile) + ',' + this.filteringSelector,
groupLabels: this.groupLabels,
instanceLabels: this.instanceLabels,
aggLevel: if this.totalTimeMetricsRepeat then 'instance' else 'group',
Expand Down
2 changes: 1 addition & 1 deletion kafka-observ-lib/signals/zookeeperClient.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local commonlib = import 'common-lib/common/main.libsonnet';

function(this)
{
filteringSelector: this.filteringSelector + ', quantile="%s"' % this.zookeeperClientQuantile,
filteringSelector: ('quantile="%s"' % this.zookeeperClientQuantile) + ',' + this.filteringSelector,
groupLabels: this.groupLabels,
instanceLabels: this.instanceLabels,
aggLevel: 'instance',
Expand Down
2 changes: 1 addition & 1 deletion process-observ-lib/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// 'instanceLabels' - one or more labels that can be used to identify single entity of instances. In simple cases, can be 'instance' or 'pod'.
// 'uid' - UID to prefix all dashboards original uids
local this = self,
filteringSelector: 'job!=""',
filteringSelector: '', // set to apply static filters to all queries and alerts, i.e. job="bar"
groupLabels: ['job'],
instanceLabels: ['instance'],
dashboardTags: [self.uid],
Expand Down
2 changes: 1 addition & 1 deletion windows-mixin/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// labels to identify single windows host:
instanceLabels: ['instance'],
// selector to include in all queries(including alerts)
filteringSelector: 'job=~".*windows.*"',
filteringSelector: '',
// prefix all dashboards uids and alert groups
uid: 'windows',
// prefix dashboards titles
Expand Down
6 changes: 3 additions & 3 deletions windows-observ-lib/alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
{
alert: 'WindowsCPUHighUsage',
expr: |||
100 - (avg without (mode, core) (rate(windows_cpu_time_total{%(filteringSelector)s, mode="idle"}[2m])) * 100) > %(alertsCPUThresholdWarning)s
100 - (avg without (mode, core) (rate(windows_cpu_time_total{mode="idle", %(filteringSelector)s}[2m])) * 100) > %(alertsCPUThresholdWarning)s
||| % this.config,
'for': '15m',
keep_firing_for: '5m',
Expand Down Expand Up @@ -133,7 +133,7 @@
{
alert: 'WindowsServiceNotHealthy',
expr: |||
windows_service_status{%(filteringSelector)s, status!~"starting|stopping|ok"} > 0
windows_service_status{status!~"starting|stopping|ok", %(filteringSelector)s} > 0
||| % this.config,
'for': '5m',
labels: {
Expand All @@ -150,7 +150,7 @@
{
alert: 'WindowsDiskDriveNotHealthy',
expr: |||
windows_disk_drive_status{%(filteringSelector)s, status="OK"} != 1
windows_disk_drive_status{status="OK", %(filteringSelector)s} != 1
||| % this.config,
'for': '5m',
labels: {
Expand Down
2 changes: 1 addition & 1 deletion windows-observ-lib/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// 'uid' - UID to prefix all dashboards original uids
groupLabels: ['job'],
instanceLabels: ['instance'],
filteringSelector: 'job=~".*windows.*"',
filteringSelector: '', // set to apply static filters to all queries and alerts, i.e. job="windows"
dashboardTags: ['windows'],
uid: 'windows',
dashboardNamePrefix: '',
Expand Down
2 changes: 1 addition & 1 deletion zookeeper-observ-lib/config.libsonnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
local this = self,
filteringSelector: 'job!=""',
filteringSelector: '', // set to apply static filters to all queries and alerts, i.e. job="bar"
groupLabels: ['job'],
instanceLabels: ['instance'],
uid: 'zookeeper',
Expand Down

0 comments on commit 43f9639

Please sign in to comment.