code: @SuppressWarnings("unchecked")
    protected <T extends Meter> T getOrCreate(Id id, Class<T> cls, T dflt, Function<Id, T> factory) {
      try {
        Preconditions.checkNotNull(id, "id");
        Meter m = Utils.computeIfAbsent(meters, id, i -> compute(factory.apply(i), dflt));
        if (!cls.isAssignableFrom(m.getClass())) {
          logTypeError(id, cls, m.getClass());
          m = dflt;
        }
        return (T) m;
      } catch (Exception e) {
        propagate(e);
        return dflt;
      }
    }
docs: Helper used to get or create an instance of a core meter type. This is mostly used
  internally to this implementation, but may be useful in rare cases for creating
  customizations based on a core type in a sub-class.
  
  @param id
  Identifier used to lookup this meter in the registry.
  @param cls
  Type of the meter.
  @param dflt
  Default value used if there is a failure during the lookup and it is not configured
  to propagate.
  @param factory
  Function for creating a new instance of the meter type if one is not already available
  in the registry.
  @return
  Instance of the meter.