prometheus-community / prometheus-community/postgres_exporter
Add "granted" to pg_locks_count as a label
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 835
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 10
Description
Proposal
The current pg_locks_count metric doesn't differentiate between granted and not granted locks. To learn about the current congestion in the database, it would be good to divide the number of locks between granted and not-yet-granted locks.
Link to the table definition in the PostgreSQL docs: https://www.postgresql.org/docs/current/view-pg-locks.html
For now, I'll go with a custom query, still I'd assume this feature would be helpful for other as well.
Starting with PostgreSQL 14 there is also the column waitstart that would allow to calculate the accumulated waiting time for all not-yet-granted locks. I assume that would be a different metric.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the exporter query or entry point that produces the pg_locks_count metric, then compare it with PostgreSQL's pg_locks table definition. Add a granted distinction so granted and not-yet-granted locks can be counted separately, and verify the resulting metric preserves the existing count while exposing both states.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql, prometheus
- Domain
- databases, observability
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100