darold / pgbadger

A fast PostgreSQL Log Analyzer
http://pgbadger.darold.net/
PostgreSQL License
3.53k stars 349 forks source link

Add suport for `pgbouncer`'s average waiting time #788

Closed franciscoreinolds closed 1 year ago

franciscoreinolds commented 1 year ago

Hello, @darold 👋🏽

I noticed that despite pgbouncer supporting the reporting of wait_time since the 1.8.0 release, that this is not yet supported by pgbadger. So, I took some inspiration from how the computations for the average duration of queries was done to achieve the same thing.

This is the relevant output of running pgbadger t/fixtures/pgbouncer.log.gz, which seems correct, taking the values (listed below) into account:

image

zcat -f t/fixtures/pgbouncer.log.gz | grep "wait time" 
2018-09-12 16:09:54.778 3394 LOG stats: 281 xacts/s, 1967 queries/s, in 118855 B/s, out 93433 B/s, xact 17057 us, query 2360 us, wait time 8672 us
2018-09-12 16:10:54.781 3394 LOG stats: 481 xacts/s, 481 queries/s, in 29782 B/s, out 103650 B/s, xact 487 us, query 487 us, wait time 13727 us
2018-09-12 16:11:54.785 3394 LOG stats: 0 xacts/s, 0 queries/s, in 0 B/s, out 0 B/s, xact 0 us, query 0 us, wait time 0 us
2018-09-12 16:12:54.787 3394 LOG stats: 0 xacts/s, 0 queries/s, in 0 B/s, out 0 B/s, xact 0 us, query 0 us, wait time 0 us
2018-09-12 16:13:54.789 3394 LOG stats: 303 xacts/s, 2124 queries/s, in 128355 B/s, out 100904 B/s, xact 19782 us, query 2709 us, wait time 1776 us
darold commented 1 year ago

I have missed that, thank you very much Fransciso.