router: implemented rewrite rules

As requested in issue #10, implemented rewrite rules to operate on the
metric names.  This is a first shot, which may not be perfect yet.

A lot of things had to change since the metric now can be changed (the
rewrite does) meaning the original input cannot be considered immutable
any more.  Alternative would be to resubmit the rewritten metrics, but
that would potentially generate a loop.  Therefore, in the current
implementation, the metrics are rewritten in-place, continuing the
execution patch of matching.