Fix PostgreSQL Dashboard — PromQL label mismatch - #41
Open
mac119 wants to merge 1 commit into
Open
Conversation
…ion and Health Score panels
Author
simranquirky
self-requested a review
June 22, 2026 14:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




PR: Fix PostgreSQL Dashboard — PromQL label mismatch causing "No Data" panels
Summary
Fix two panels in the PostgreSQL Metrics dashboard that display "No Data" due to PromQL binary operation label mismatch. The
postgresql_backendsmetric carries apostgresql_database_namelabel, whilepostgresql_connection_maxdoes not. When PromQL performs arithmetic between two vectors, it requires matching label sets on both sides — mismatched labels result in empty results.Additionally, the
Connection Utilization %panel legend template{postgresql_database_name}renders as a raw string becausesum()aggregation removes all labels, making the template variable unresolvable.Problem
Root Cause: Label Mismatch in PromQL Binary Operations
The OpenTelemetry PostgreSQL receiver emits metrics with different label sets:
postgresql_backendspostgresql_database_name,service_instance_id,instrumentation_library_name, ...postgresql_connection_maxservice_instance_id,instrumentation_library_name, ... (nopostgresql_database_name)When performing division
postgresql_backends / postgresql_connection_max, PromQL requires exact label matching between left and right operands. Sincepostgresql_backendshas an extrapostgresql_database_namelabel, no vector elements match → result is empty ("No Data").Affected Panels
1. Connection Utilization %
{postgresql_database_name}instead of a meaningful name2. Database Health Score
postgresql_backends,postgresql_connection_max,postgresql_blks_hit,postgresql_blks_read,postgresql_commits, andpostgresql_rollbacksall have different label setsFix
Wrap all metrics in
sum()to aggregate away label dimensions before performing arithmetic. This ensures both sides of binary operations have matching (empty) label sets.Panel: Connection Utilization %
Before:
After:
Legend fix: Changed from
{postgresql_database_name}→Utilization %sum()removes all labels, so template variables cannot be resolved and render as raw strings.Panel: Database Health Score
Before:
After:
Verification
Tested against OpenObserve with otelcol-contrib v0.151.0 collecting from PostgreSQL 18.3:
Environment
Files Changed
PostgreSQL Metrics/PostgreSQL.dashboard.jsonConnection Utilization %panel query and legendDatabase Health Scorepanel query