Skip to content

Change Prometheus expression to use max function and fix "First Recoverability Point" panel (id 237)#61

Open
jrmclx wants to merge 6 commits into
cloudnative-pg:mainfrom
jrmclx:patch-1
Open

Change Prometheus expression to use max function and fix "First Recoverability Point" panel (id 237)#61
jrmclx wants to merge 6 commits into
cloudnative-pg:mainfrom
jrmclx:patch-1

Conversation

@jrmclx
Copy link
Copy Markdown

@jrmclx jrmclx commented May 20, 2026

Objective is to fix "First Recoverability Point" panel (id 237) returning "vector cannot contain metrics with the same labelset" error

The panel query was failing with the error "vector cannot contain metrics with the same labelset" when both metrics matched by name=~ share the same labelset, because Prometheus drops the name label during vector evaluation, causing a collision.

The fix wraps the selector with max(), which is already used in the equivalent panel elsewhere in the same dashboard (panel id 364). This deduplicates the series and resolves the collision.

Before:

{__name__=~"cnpg_collector_first_recoverability_point|barman_cloud_cloudnative_pg_io_first_recoverability_point",namespace=~"$namespace",pod=~"$instances"}*1000 > 0
Capture d'écran 2026-05-20 165201

After:

max({__name__=~"cnpg_collector_first_recoverability_point|barman_cloud_cloudnative_pg_io_first_recoverability_point",namespace=~"$namespace",pod=~"$instances"})*1000 > 0
Capture d'écran 2026-05-20 221641

Objective is to fix "First Recoverability Point" panel (id 237) returning "vector cannot contain metrics with the same labelset" error

The panel query was failing with the error "vector cannot contain metrics with the same labelset" when both metrics matched by __name__=~ share the same labelset, because Prometheus drops the __name__ label during vector evaluation, causing a collision.

The fix wraps the selector with max(), which is already used in the equivalent panel elsewhere in the same dashboard (panel id 364). This deduplicates the series and resolves the collision.

Before:

{__name__=~"cnpg_collector_first_recoverability_point|barman_cloud_cloudnative_pg_io_first_recoverability_point",namespace=~"$namespace",pod=~"$instances"}*1000 > 0


After:

max({__name__=~"cnpg_collector_first_recoverability_point|barman_cloud_cloudnative_pg_io_first_recoverability_point",namespace=~"$namespace",pod=~"$instances"})*1000 > 0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant