(CDAP-1090) Feature/metrics search

Search for metrics context and available metrics.
https://issues.cask.co/browse/CDAP-1090
This method is pretty long and complex and almost without any doc/comments. Please document it well or better refactor it into smaller logical unit.