How to troubleshoot metric query issues