async aggregateStats({emailIds = [], memberIds = []}, includeOpenedEvents = true) {
        let startTime = Date.now();
        logging.info(`[EmailAnalytics] Aggregating for ${emailIds.length} emails`);

        for (const emailId of emailIds) {
            await this.aggregateEmailStats(emailId, includeOpenedEvents);
        }
        let endTime = Date.now() - startTime;
        logging.info(`[EmailAnalytics] Aggregating for ${emailIds.length} emails took ${endTime}ms`);

        startTime = Date.now();
        logging.info(`[EmailAnalytics] Aggregating for ${memberIds.length} members`);

        // @ts-expect-error
        const memberMetric = this.prometheusClient?.getMetric('email_analytics_aggregate_member_stats_count');
        for (const memberId of memberIds) {
            await this.aggregateMemberStats(memberId);
            memberMetric?.inc();
        }
        endTime = Date.now() - startTime;
        logging.info(`[EmailAnalytics] Aggregating for ${memberIds.length} members took ${endTime}ms`);
    }
@param {{emailIds?: string[], memberIds?: string[]}} stats
@param {boolean} includeOpenedEvents