docs: @SuppressWarnings("unchecked")
      public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
          if (metric instanceof MetricSet) {
              registerAll(name, (MetricSet) metric);
          } else {
              final Metric existing = metrics.putIfAbsent(name, metric);
              if (existing == null) {
                  onMetricAdded(name, metric);
              } else {
                  throw new IllegalArgumentException("A metric named " + name + " already exists");
              }
          }
          return metric;
      }