feat: add live Postgres metric tiles to the Cluster detail page - #31
Open
YogeshJain96 wants to merge 2 commits into
Open
YogeshJain96 wants to merge 2 commits into
YogeshJain96 wants to merge 2 commits into
Conversation
Each tile execs a one-shot psql query into an instance, grouped by category: CNPG-specific replication/WAL archiving state, and general health (connections, cache hit ratio, database size, blocked queries, deadlocks). Health metrics get a per-instance switch, plus an optional 5s/10s/30s auto-refresh. Signed-off-by: Yogesh Jain <contactyogeshjain@gmail.com>
Signed-off-by: Yogesh Jain <contactyogeshjain@gmail.com>
gbartolini
reviewed
Sep 17, 2026
| } | ||
| }, | ||
| { | ||
| command: ['psql', '-U', 'postgres', '-d', database, '-X', '-tAc', query], |
Contributor
There was a problem hiding this comment.
Mhhh ... why do you need to access the database as postgres? I'd rather have you fetch the Prometheus exporter directly and parse those, rather than querying the database. That way we can reuse what we already have. We should push back on superuser connections, always. The exporter uses a regular user called cnpg_metrics_exporter. You could reuse that, but you need to find a different way to connect to the database I guess.
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.
Each tile execs a one-shot psql query into an instance, grouped by category: CNPG-specific replication/WAL archiving state, and general health (connections, cache hit ratio, database size, blocked queries, deadlocks). Health metrics get a per-instance switch, plus an optional 5s/10s/30s auto-refresh.
Future Scope: We can let user add/edit/remove their own metric entries at runtime, on top of this fixed, built-in set. Persist them in a small ConfigMap in the cluster (we already have the k8s API access to read/write one) so they're shared across anyone using this plugin against it, not just saved locally in one browser.