Re: contrib/pg_stat_tcpinfo
Jakub Wartak <jakub.wartak@enterprisedb.com>
From: Jakub Wartak <jakub.wartak@enterprisedb.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Date: 2025-11-07T10:36:05Z
Lists: pgsql-hackers
Attachments
- v2-0001-pg_stat_tcpinfo.patch (text/x-patch)
On Mon, Nov 3, 2025 at 3:09 PM Jakub Wartak <jakub.wartak@enterprisedb.com> wrote: > > Attached is pg_stat_tcpinfo, an heavy work in progress, Linux-only > netstat/ss-like extension for showing detailed information about TCP > connections based on information from the kernel itself. [..] > Some early feedback about direction in order to bring this into core > would be appreciated. State of stuff: > > 1. Andres is pushing for supporting UNIX domain sockets here, but I'm > not sure if it is really worth the effort (and it would trigger new > naming problem;)) and primarily making the code even more complex. > IMHO the netlinksock_diag API is already convoluted and adding AF_UNIX > would make it even less readable. > 2. IPv6 works, but wasn't tested much. > 3. Biggest TODO left is probably properly formatting the information > based on struct tcpinfo variables (just like ss(1) does, so keeping > the same unit/formatting) > 4. Patch/tests are missing intentionally as I would like first to > stabilize the outputs/naming/code first. > 5. [security] Should this be available to pg_monitor/pg_read_all_stats > or just to superuser? > 6. [security] Should this return info about all TCP connections or > just the UID of the postmaster? v2 attached with tiny fixes and little more code readability (for dumping struct tcpinfo *) -J.