fix query call in metrics code