Skip to content

add(metrics): expose db pool flushes counter#4658

Closed
mkleczek wants to merge 1 commit intoPostgREST:mainfrom
mkleczek:add-pool-flushes-metric
Closed

add(metrics): expose db pool flushes counter#4658
mkleczek wants to merge 1 commit intoPostgREST:mainfrom
mkleczek:add-pool-flushes-metric

Conversation

@mkleczek
Copy link
Contributor

@mkleczek mkleczek commented Feb 17, 2026

Emit a dedicated PoolFlushed observation when the DB pool is released during schema cache reload and expose it as pgrst_db_pool_flushes_total.

Stacked on top of #4659 to make tests more readable

@mkleczek mkleczek force-pushed the add-pool-flushes-metric branch 2 times, most recently from bd4435f to bdb52e7 Compare February 17, 2026 13:05
@mkleczek mkleczek force-pushed the add-pool-flushes-metric branch 2 times, most recently from 38ebc23 to 4e007c2 Compare February 17, 2026 20:27
**Type** Counter
======== =======

The total number of times the pool was flushed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should mention this means releasing all the connections in the pool, which always happens during schema cache load?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which always happens during schema cache load?

Hm, actually I'm not sure if the above will be true once #4645 is merged

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which always happens during schema cache load?

Hm, actually I'm not sure if the above will be true once #4645 is merged

@steve-chavez Added a short sentence to the documentation.

@mkleczek mkleczek force-pushed the add-pool-flushes-metric branch 5 times, most recently from 8755576 to a323d91 Compare February 20, 2026 05:25
Emit a dedicated PoolFlushed observation when the DB pool is released during schema cache reload and expose it as pgrst_db_pool_flushes_total.
@mkleczek mkleczek force-pushed the add-pool-flushes-metric branch from a323d91 to e771d73 Compare February 20, 2026 05:46
@steve-chavez
Copy link
Member

One question, would this be generally useful? I mean besides for testing #4645.

I haven't seen this metric on OTel db metrics although I have seen numDestroys in some other place (not sure if these are Prom metrics).

@steve-chavez
Copy link
Member

If not generally useful, maybe this metric can be private and not exposed to users? That way we can use it for tests only.

@mkleczek
Copy link
Contributor Author

If not generally useful, maybe this metric can be private and not exposed to users? That way we can use it for tests only.

@steve-chavez I agree. There is no need for this metric, only observation.
Closing this PR and raising #4668 instead.

@mkleczek mkleczek closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants