move metrics.js to core