code: public static MetricKey metricKey(String metric, String... tags) {
  
          if (tags == null || tags.length == 0) {  //if no tags supplied, the original metric name is used for both cache key and registry key.
              return new MetricKey(metric, metric);
          } else { //if tag is supplied, append tag value to form cache key; original metric name is registry key.
              StringBuilder sb = new StringBuilder(metric);
              Preconditions.checkArgument((tags.length % 2) == 0, "Tags is a set of key/value pair so the size must be even: %s", tags.length);
              for (int i = 0; i < tags.length; i += 2) {
                  Preconditions.checkArgument(!Strings.isNullOrEmpty(tags[i]) || !Strings.isNullOrEmpty(tags[i + 1]), "Tag name or value cannot be empty or null");
                  sb.append('.').append(tags[i + 1]);
              }
              return new MetricKey(sb.toString(), metric);
          }
      }
docs: Create an MetricKey object based on metric name, metric type and tags associated.
  The MetricKey object contains cache key for cache lookup and registry key for registry lookup.
  
  @param metric the metric name.
  @param tags the tag(s) associated with the metric.
  @return the MetricKey object contains cache lookup key and metric registry key.