Hi! Overall solution looks good for me except SQL Commenter - query instrumentation with SQL comments is often not possible on production systems. Instead the very often requested feature is to enable tracing for a given single query ID, or several (very limited number of) queries by IDs. It could be done by adding SQL function to add and remove query ID into a list (even array would do) stored in top tracing context.
Great job, thank you! -- Regards, Nikita Malakhov Postgres Professional The Russian Postgres Company https://postgrespro.ru/