Fix bug null pointer allMetrics