public Map<String, Long> numberOfOverdueTriggers() {
        final DateTime now = clock.nowUTC();
        final AggregateIterable<OverdueTrigger> result = collection.aggregate(List.of(
                Aggregates.match(
                        // We deliberately don't include the filter to include expired trigger locks we use in
                        // #nextRunnableTrigger because we consider that an edge case that's not important for
                        // the overdue calculation.
                        and(
                                eq(FIELD_LOCK_OWNER, null),
                                eq(FIELD_STATUS, JobTriggerStatus.RUNNABLE),
                                lte(FIELD_NEXT_TIME, now),
                                or(
                                        not(exists(FIELD_END_TIME)),
                                        eq(FIELD_END_TIME, null),
                                        gte(FIELD_END_TIME, now)
                                )
                        )
                ),
                Aggregates.group(
                        "$" + FIELD_JOB_DEFINITION_TYPE,
                        Accumulators.sum("count", 1)
                )
        ), OverdueTrigger.class);

        return stream(result).collect(Collectors.toMap(OverdueTrigger::type, OverdueTrigger::count));
    }
@Test
    @MongoDBFixtures("job-triggers-for-overdue-count.json")
    public void numberOfOverdueTriggers() {
        final JobSchedulerTestClock clock = new JobSchedulerTestClock(DateTime.parse("2019-01-01T04:00:00.000Z"));
        final DBJobTriggerService service = serviceWithClock(clock);

        final Map<String, Long> result = service.numberOfOverdueTriggers();

        assertThat(result).isEqualTo(Map.of(
                "event-processor-execution-v1", 2L,
                "notification-execution-v1", 1L
        ));
    }