move manipulations with metrics to dedicated helper

Change-Id: Ie1be479216a272afe0e51698c97e0c2403c75699
Reviewed-on: http://review.couchbase.org/36849
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Li Yang <lichenyang2@gmail.com>