Add a middleware interface to transform the data of metrics on the fly