Make aggregate function for metrics configurable