private boolean isValidPkgLength(HttpEventInfo eventInfo, int allowedLen, ProcessResult procResult) {
        // Not valid if the maximum limit is less than or equal to 0
        if (allowedLen < 0) {
            return true;
        }
        int eventLen = eventInfo.getBodySize()
                + eventInfo.getGroupId().length()
                + eventInfo.getStreamId().length()
                + String.valueOf(eventInfo.getDtMs()).length();
        // Reserve space for attribute
        if (eventLen > allowedLen - SdkConsts.RESERVED_ATTRIBUTE_LENGTH) {
            String errMsg = String.format("OverMaxLen: content length(%d) > allowedLen(%d) - fixedLen(%d)",
                    eventLen, allowedLen, SdkConsts.RESERVED_ATTRIBUTE_LENGTH);
            if (httpExceptCnt.shouldPrint()) {
                logger.warn(errMsg);
            }
            return procResult.setFailResult(ErrorCode.REPORT_INFO_EXCEED_MAX_LEN, errMsg);
        }
        return true;
    }
HTTP(s) Message Sender class

Used to define the HTTP(s) sender common methods
inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/sender/http/InLongHttpMsgSender.java