code: void printMap(PrintWriter out, Map<String, Map<String, List<TagsMetricsPair>>> map) {
      for (Map.Entry<String, Map<String, List<TagsMetricsPair>>> context : map.entrySet()) {
        out.println(context.getKey());
        for (Map.Entry<String, List<TagsMetricsPair>> record : context.getValue().entrySet()) {
          indent(out, 1);
          out.println(record.getKey());
          for (TagsMetricsPair pair : record.getValue()) {
            indent(out, 2);
            // Prints tag values in the form "{key=value,key=value}:"
            out.print("{");
            boolean first = true;
            for (Map.Entry<String, Object> tagValue : pair.tagMap.entrySet()) {
              if (first) {
                first = false;
              } else {
                out.print(",");
              }
              out.print(tagValue.getKey());
              out.print("=");
              out.print(tagValue.getValue().toString());
            }
            out.println("}:");
            
            // Now print metric values, one per line
            for (Map.Entry<String, Number> metricValue : 
                pair.metricMap.entrySet()) {
              indent(out, 3);
              out.print(metricValue.getKey());
              out.print("=");
              out.println(metricValue.getValue().toString());
            }
          }
        }
      }    
    }
docs: Prints metrics data in a multi-line text form.