prometheus-community / prometheus-community/postgres_exporter
Logical replication details with pg_subscription_rel
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 835
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 10
Description
Proposal
Use case. Why is this important?
We use logical replication and already have slot replication monitoring. However, this doesn't give a precise view: pg_subscription_rel gives useful information about logical replication health:
SELECT *, srrelid::regclass FROM pg_subscription_rel;
srsubid | srrelid | srsubstate | srsublsn | srrelid
---------+---------+------------+---------------+----------------------------------------
271645 | 16812 | d | | schema1.tableA
271645 | 17663 | d | | schema2.tableB
271645 | 25779 | r | B5C4/DB99BA58 | schema1.tableC
271645 | 16800 | r | B5C4/DB99BA58 | schema2.tableD
[...]
This could be useful to get metrics like
pg_subscription_rel{relation="schema1.tableA", state="d"}
pg_subscription_rel{relation="schema2.tableB", state="d"}
pg_subscription_rel{relation="schema1.tableC", state="r"}
pg_subscription_rel{relation="schema2.tableD", state="r"}
I'm not sure how lsn data could be useful here but it's still a good start to me.
If the format looks ok, we can provide a PR for this :)
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
No file or test is named. Start by reviewing the existing slot replication monitoring and the PostgreSQL pg_subscription_rel documentation; the work is done when logical replication relation state is exposed as useful Prometheus metrics, with the proposed relation and state labels represented consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql, prometheus
- Domain
- databases, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100