refactor code

improve metricdata