public static List<StatData> aggregateStatData(List<StatData> data, String streamId) {
        if (data == null || data.isEmpty()) {
            return new ArrayList<>();
        }

        Map<String, StatData> aggregatedMap = new HashMap<>(data.size());
        for (StatData stat : data) {
            StatData aggregatedStatData = aggregatedMap.computeIfAbsent(
                    stat.getCompositeKey(),
                    k -> new StatData(stat.getLogTs(), stat.getInlongGroupId(), streamId, stat.getAuditId()));
            aggregatedStatData.add(stat.getCount(), stat.getSize(), stat.getDelay());
        }

        return new ArrayList<>(aggregatedMap.values());
    }
Aggregates statistics data by composite key.

@param data     List of StatData to be aggregated
@param streamId Stream ID to use for aggregation
@return List of aggregated StatData
inlong-audit/audit-service/src/main/java/org/apache/inlong/audit/service/utils/AuditUtils.java