code: protected String toTagParameterArray(Map<String, String> tags) throws UnsupportedEncodingException {
      	if(tags == null || tags.isEmpty()) {
      		return "";
      	}
      	
          StringBuilder sb = new StringBuilder(encode("{", "UTF-8"));
          for (Map.Entry<String, String> tagEntry : tags.entrySet()) {
              sb.append(tagEntry.getKey()).append("=");
  
              String tagV = tagEntry.getValue().replaceAll("\\|", encode("|", "UTF-8"));
  
              sb.append(tagV).append(",");
          }
          sb.replace(sb.length() - 1, sb.length(), encode("}", "UTF-8"));
          
          return sb.toString();
      }
docs: Returns the tags in TSDB query string format.
  
  @param   tags  The tags to convert. Can be null.
  
  @return  The formatted tags.
  
  @throws  UnsupportedEncodingException  If UTF-8 is not supported.