refactor alert-query to use alert API