refactored metric sender into seperate package

Functions that dealt with sending metrics have been removed from state into a new apiserver/metricsender package.