private HashMap convertMap(Map<String, Object> map) {
    HashMap retVal = new HashMap(map);
    for (Map.Entry<String, Object> entry : map.entrySet()) {
      if (entry.getValue() instanceof Map) {
        retVal.put(entry.getKey(), convertMap((Map<String, Object>) entry.getValue()));
      }
    }
    return retVal;
  }
Metrics returns an UnmodifiableMap.
Unmodifiable maps should not be serialized with type, because UnmodifiableMap cannot be deserialized.
So we convert to HashMap.
samza-core/src/main/scala/org/apache/samza/serializers/MetricsSnapshotSerdeV2.java