-
-
Notifications
You must be signed in to change notification settings - Fork 187
feat: add queries for additional metrics #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -35,6 +173,17 @@ auth_users: | |||
usage: "GAUGE" | |||
description: "Number of users in the project db" | |||
|
|||
replication: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll select the series of interest with e.g. replication_realtime_lag{slot_name="realtime"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@darora Gotcha, would it be preferable to make that part of the query?
i.e. SELECT slot_name, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) as replication_lag FROM pg_replication_slots WHERE slot_name = 'realtime';
Also, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)
outputs lag in bytes. Would it be preferable to use pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn))
since its output is more reader friendly (e.g. 92 kB)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can divide it if desired, though it needs to be scalar so we wouldn't want to use pg_size_pretty
. Generally, the norm in this space is to keep the native units (e.g. bytes), and then allow the frontends to convert them as appropriate.
Happy to select for realtime in the query, was leaving it this way in case we wanted info on other replications (now or in the future).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarified by renaming metric to replication_realtime_lag_bytes
(also more idiomatic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
norm in this space is to keep the native units (e.g. bytes), and then allow the frontends to convert them as appropriate
thanks, good to know!
551841e
to
b0314b2
Compare
* feat: add queries for additional metrics * chore: filter for realtime replication lag * chore: add realtime replication slot active status Co-authored-by: Wen Bo Xie <wenbo.xie3@gmail.com>
feat: add queries for additional metrics (#59)
* feat: add queries for additional metrics * chore: filter for realtime replication lag * chore: add realtime replication slot active status Co-authored-by: Wen Bo Xie <wenbo.xie3@gmail.com>
* feat: add queries for additional metrics * chore: filter for realtime replication lag * chore: add realtime replication slot active status Co-authored-by: Wen Bo Xie <wenbo.xie3@gmail.com>
feat: add queries for additional metrics (supabase#59)
No description provided.