tridentli / pitchfork

Golang framework for secure communication platforms.
Apache License 2.0
5 stars 3 forks source link

DB: Per-Context DB statistics / Log Slow Requests #128

Open massar opened 7 years ago

massar commented 7 years ago

Retain statistics for each query request and thus simply per context and then log slow requests.

Especially in the situation where nginx already has given up (and thus a HTTP Gateway timeout) is returned, we should log the details of this event (gateway disconnect, which can be detected with ErrIsDisconnect error, eg in page_render; also log it when a request takes more than X seconds.

We have to do this in lib/db.go as the Golang PostgreSQL driver does not do this for us.

PS: Might want to investigate options that postgresql provides inside the server