Rewrite of Metrics, using couchdb as a backend