Skip to content

fix(cluster): Fix invalid PromQL#868

Open
Allex1 wants to merge 1 commit into
cloudnative-pg:mainfrom
Allex1:fix-promql
Open

fix(cluster): Fix invalid PromQL#868
Allex1 wants to merge 1 commit into
cloudnative-pg:mainfrom
Allex1:fix-promql

Conversation

@Allex1
Copy link
Copy Markdown

@Allex1 Allex1 commented May 11, 2026

Two categories of parse errors prevented the PrometheusRule from being accepted when monitoring.enabled=true:

  1. CNPGClusterLogicalReplicationErrors and CNPGClusterLogicalReplicationErrorsCritical: increase() was wrapping max by()(A + B)[5m], applying a range selector to an aggregated instant vector, which is illegal in PromQL. Fix: apply increase([5m]) to each individual metric selector before aggregating.

  2. CNPGClusterLogicalReplicationStopped and CNPGClusterLogicalReplicationStoppedCritical: cnpg_pg_stat_subscription_pid (a numeric gauge) was compared with "" (a string), which is not a valid PromQL binary expression. Fix: compare with 0 instead.

Screenshot 2026-05-11 at 09 08 18

@Allex1 Allex1 requested a review from itay-grudev as a code owner May 11, 2026 06:08
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working chart( cluster ) Related to the cluster chart labels May 11, 2026
Two categories of parse errors prevented the PrometheusRule from being
accepted when monitoring.enabled=true:

1. CNPGClusterLogicalReplicationErrors and CNPGClusterLogicalReplicationErrorsCritical:
   `increase()` was wrapping `max by()(A + B)[5m]`, applying a range selector
   to an aggregated instant vector, which is illegal in PromQL. Fix: apply
   `increase([5m])` to each individual metric selector before aggregating.

2. CNPGClusterLogicalReplicationStopped and CNPGClusterLogicalReplicationStoppedCritical:
   `cnpg_pg_stat_subscription_pid` (a numeric gauge) was compared with `""`
   (a string), which is not a valid PromQL binary expression. Fix: compare
   with `0` instead.

Signed-off-by: Allex1 <Allex21ro@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working chart( cluster ) Related to the cluster chart size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant