Duplex filters are filters that are invoked for both requests from database clients and responses from database servers. They are useful when you need a complete picture of everything that is happening, for instance when gathering metrics.
Duplex filters for Postgres
Metrics filter : collects and outputs metrics on SQL operations, bytes in and out, and response sizes, and prints them at intervals to a file or a logger.
Metrics code filter : same as Metrics filter, but passes the metrics to user code