code: private static Map.Entry<String, String> maybeTruncateTagEntry(Map.Entry<String, String> tag_entry) {
          String k = tag_entry.getKey();
          String v = tag_entry.getValue();
          if (k.length() + v.length() <= MAX_TAG_KEY_VAL_CHARS - 2) // 2 chars for the quotes around the value
              return tag_entry;
  
          if (k.length() > TRUNCATE_TAG_NAME)
              k = k.substring(0, TRUNCATE_TAG_NAME);
          if (k.length() + v.length() > MAX_TAG_KEY_VAL_CHARS - 2)
              v = v.substring(0, MAX_TAG_KEY_VAL_CHARS - 2 - k.length());
          return SimpleMapEntry.create(k, v);
      }
docs: Truncate tag keys and values, to prevent them from exceeding the max
  length of a tag entry.