public boolean addEvent(ProfileEvent event, long maxPackCount, long maxPackSize) {
        long eventLength = event.getBody().length;
        if (count >= maxPackCount || (count > 0 && size + eventLength > maxPackSize)) {
            return false;
        }
        this.events.add(event);
        this.count++;
        this.size += eventLength;
        return true;
    }
addEvent

@param  event
@param  maxPackCount
@param  maxPackSize
@return
inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/dispatch/DispatchProfile.java