class PrometheusMetricsProviderImpl implements MetricsProvider {

    @Override
    public IntegrationMetricsSummary getTotalIntegrationMetricsSummary() {
        final Optional<Long> totalMessages = getSummaryMetricValue(METRIC_TOTAL, Long.class, "sum");
        final Optional<Long> failedMessages = getSummaryMetricValue(METRIC_FAILED, Long.class, "sum");

        final List<Pod> serverList = openShiftClient.pods().withLabelSelector(SELECTOR).list().getItems();
        final Optional<Instant> startTime;
        if (!serverList.isEmpty()) {
            startTime = Optional.of(Instant.parse(serverList.get(0).getStatus().getStartTime()));
        } else {
            if (LOG.isWarnEnabled()) {
                LOG.warn("Missing syndesis-server pod in lookup with selector " + LABELS);
            }
            startTime = Optional.empty();
        }

        // compute last processed time
        final Optional<Instant> lastCompletedTime = getAggregateMetricValue(METRIC_COMPLETED_TIMESTAMP, Instant.class, MAX);
        final Optional<Instant> lastFailureTime = getAggregateMetricValue(METRIC_FAILURE_TIMESTAMP, Instant.class, MAX);
        final Optional<Instant> lastProcessedTime = Optional.ofNullable(max(lastCompletedTime.orElse(null), lastFailureTime.orElse(null)));

        // get top 5 integrations by total messages
        return new IntegrationMetricsSummary.Builder()
            .metricsProvider("prometheus")
            // set as long values instead of long and nano parts as the UI don't need to handle the nano part
            .start(startTime.map(st -> Instant.ofEpochMilli(st.toEpochMilli() * 1000)))
            .lastProcessed(lastProcessedTime.map(lp -> Instant.ofEpochMilli(lp.toEpochMilli() * 1000)))
            .uptimeDuration(startTime.map(date -> Duration.between(date, Instant.now()).toMillis()).orElse(0L))
            .messages(totalMessages.orElse(0L))
            .errors(failedMessages.orElse(0L))
            .topIntegrations(getTopIntegrations())
            .build();
    }

    protected  PrometheusMetricsProviderImpl(PrometheusConfigurationProperties config, NamespacedOpenShiftClient openShiftClient);

}