add support for metrics filter and metrics rewrite