code: public static MetricContext newContextFromReferenceContext(MetricContext context, List<Tag<?>> newTags,
        Optional<String> name) {
  
      String newName = name.orNull();
  
      if (Strings.isNullOrEmpty(newName)) {
        UUID uuid = UUID.randomUUID();
        String randomIdPrefix = "uuid:";
  
        String oldName = context.getName();
        List<String> splitName = Strings.isNullOrEmpty(oldName) ? Lists.<String> newArrayList()
            : Lists.newArrayList(Splitter.on(".").splitToList(oldName));
        if (splitName.size() > 0 && StringUtils.startsWith(Iterables.getLast(splitName), randomIdPrefix)) {
          splitName.set(splitName.size() - 1, String.format("%s%s", randomIdPrefix, uuid.toString()));
        } else {
          splitName.add(String.format("%s%s", randomIdPrefix, uuid.toString()));
        }
        newName = Joiner.on(".").join(splitName);
      }
  
      MetricContext.Builder builder = context.getParent().isPresent() ? context.getParent().get().childBuilder(newName)
          : MetricContext.builder(newName);
      return builder.addTags(context.getTags()).addTags(newTags).build();
    }
docs: Generates a new {@link org.apache.gobblin.metrics.MetricContext} with the parent and tags taken from the reference context.
  Allows replacing {@link org.apache.gobblin.metrics.Tag} with new input tags.
  This method will not copy any {@link org.apache.gobblin.metrics.Metric} contained in the reference {@link org.apache.gobblin.metrics.MetricContext}.
  
  @param context Reference {@link org.apache.gobblin.metrics.MetricContext}.
  @param newTags New {@link org.apache.gobblin.metrics.Tag} to apply to context. Repeated keys will override old tags.
  @param name Name of the new {@link org.apache.gobblin.metrics.MetricContext}.
  If absent or empty, will modify old name by adding a random integer at the end.
  @return Generated {@link org.apache.gobblin.metrics.MetricContext}.