public DynamicMetricsRegistry tag(MetricsInfo info, String value, boolean override) {
    MetricsTag tag = Interns.tag(info, value);

    if (!override) {
      MetricsTag existing = tagsMap.putIfAbsent(info.name(), tag);
      if (existing != null) {
        throw new MetricsException("Tag " + info.name() + " already exists!");
      }
      return this;
    }

    tagsMap.put(info.name(), tag);

    return this;
  }
Add a tag to the metrics
@param info     metadata of the tag
@param value    of the tag
@param override existing tag if true
@return the registry (for keep adding tags etc.)
hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java