logging duration of write for metrics