Helper to handle registration of metrics.