docs: @Nullable
    private static Resource merge(@Nullable Resource resource, @Nullable Resource otherResource) {
      if (otherResource == null) {
        return resource;
      }
      if (resource == null) {
        return otherResource;
      }
  
      String mergedType = resource.getType() != null ? resource.getType() : otherResource.getType();
      Map<String, String> mergedLabelMap =
          new LinkedHashMap<String, String>(otherResource.getLabels());
  
      // Labels from resource overwrite labels from otherResource.
      for (Entry<String, String> entry : resource.getLabels().entrySet()) {
        mergedLabelMap.put(entry.getKey(), entry.getValue());
      }
      return createInternal(mergedType, Collections.unmodifiableMap(mergedLabelMap));
    }