Move metrics flags and collection into stats pkg
Add influxdb support for metrics