code: protected void addMetric(String name, Metric metric) {
  		if (metric == null) {
  			LOG.warn("Ignoring attempted registration of a metric due to being null for name {}.", name);
  			return;
  		}
  		// add the metric only if the group is still open
  		synchronized (this) {
  			if (!closed) {
  				// immediately put without a 'contains' check to optimize the common case (no collision)
  				// collisions are resolved later
  				Metric prior = metrics.put(name, metric);
  
  				// check for collisions with other metric names
  				if (prior == null) {
  					// no other metric with this name yet
  
  					if (groups.containsKey(name)) {
  						// we warn here, rather than failing, because metrics are tools that should not fail the
  						// program when used incorrectly
  						LOG.warn("Name collision: Adding a metric with the same name as a metric subgroup: '" +
  								name + "'. Metric might not get properly reported. " + Arrays.toString(scopeComponents));
  					}
  
  					registry.register(metric, name, this);
  				}
  				else {
  					// we had a collision. put back the original value
  					metrics.put(name, prior);
  
  					// we warn here, rather than failing, because metrics are tools that should not fail the
  					// program when used incorrectly
  					LOG.warn("Name collision: Group already contains a Metric with the name '" +
  							name + "'. Metric will not be reported." + Arrays.toString(scopeComponents));
  				}
  			}
  		}
  	}
docs: Adds the given metric to the group and registers it at the registry, if the group
  is not yet closed, and if no metric with the same name has been registered before.
  
  @param name the name to register the metric under
  @param metric the metric to register