Skip to content

Commit

Permalink
feat: set up the NarrowSelectorsOnIntegers alert for a smooth Prom3 u…
Browse files Browse the repository at this point in the history
…pgrade
  • Loading branch information
machine424 committed Jan 10, 2025
1 parent 0264620 commit 883058b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions assets/cluster-monitoring-operator/prometheus-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ spec:
for: 15m
labels:
severity: warning
- alert: NarrowSelectorsOnIntegers
annotations:
description: Queries to Prometheus {{$labels.namespace}}/{{$labels.pod}} could be too restrictive.
summary: |
Some queries with selectors on the values of the "le" label of classic histograms or/and the "quantile" label of summaries
may not take into account that values could also be floats.
expr: increase(prometheus_parser_narrow_selectors_on_integers_count{job=~"prometheus-k8s|prometheus-user-workload"}[5m]) > 0
for: 15m
labels:
severity: warning
- name: openshift-kubernetes.rules
rules:
- expr: sum(rate(container_cpu_usage_seconds_total{container="",pod!=""}[5m])) BY (pod, namespace)
Expand Down
15 changes: 15 additions & 0 deletions jsonnet/rules.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ function(params) {
severity: 'warning',
},
},
{
expr: 'increase(prometheus_parser_narrow_selectors_on_integers_count{job=~"prometheus-k8s|prometheus-user-workload"}[5m]) > 0',
alert: 'NarrowSelectorsOnIntegers',
'for': '15m',
annotations: {
description: 'Queries to Prometheus {{$labels.namespace}}/{{$labels.pod}} could be too restrictive.',
summary: |||
Some queries with selectors on the values of the "le" label of classic histograms or/and the "quantile" label of summaries
may not take into account that values could also be floats.
|||,
},
labels: {
severity: 'warning',
},
},
],
},
{
Expand Down
2 changes: 2 additions & 0 deletions pkg/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,8 @@ func (f *Factory) PrometheusK8s(grpcTLS *v1.Secret, telemetrySecret *v1.Secret)
if f.config.ClusterMonitoringConfiguration.PrometheusK8sConfig.LogLevel != "" {
p.Spec.LogLevel = f.config.ClusterMonitoringConfiguration.PrometheusK8sConfig.LogLevel
}
// Temp, debugging only
p.Spec.LogLevel = "debug"

if f.config.ClusterMonitoringConfiguration.PrometheusK8sConfig.Retention != "" {
p.Spec.Retention = monv1.Duration(f.config.ClusterMonitoringConfiguration.PrometheusK8sConfig.Retention)
Expand Down

0 comments on commit 883058b

Please sign in to comment.