diff --git a/airbyte-metrics/reporter/src/main/java/io/airbyte/metrics/reporter/Application.java b/airbyte-metrics/reporter/src/main/java/io/airbyte/metrics/reporter/Application.java index f64527149ba7..f8af2de13b23 100644 --- a/airbyte-metrics/reporter/src/main/java/io/airbyte/metrics/reporter/Application.java +++ b/airbyte-metrics/reporter/src/main/java/io/airbyte/metrics/reporter/Application.java @@ -4,6 +4,8 @@ package io.airbyte.metrics.reporter; +import io.airbyte.metrics.lib.MetricClientFactory; +import io.airbyte.metrics.lib.MetricEmittingApps; import io.micronaut.runtime.Micronaut; /** @@ -14,6 +16,7 @@ public class Application { public static void main(final String[] args) { + MetricClientFactory.initialize(MetricEmittingApps.METRICS_REPORTER); Micronaut.run(Application.class, args); } diff --git a/airbyte-metrics/reporter/src/main/java/io/airbyte/metrics/reporter/MetricRepository.java b/airbyte-metrics/reporter/src/main/java/io/airbyte/metrics/reporter/MetricRepository.java index 267426209283..b36f6ad15b30 100644 --- a/airbyte-metrics/reporter/src/main/java/io/airbyte/metrics/reporter/MetricRepository.java +++ b/airbyte-metrics/reporter/src/main/java/io/airbyte/metrics/reporter/MetricRepository.java @@ -146,8 +146,9 @@ SELECT status, extract(epoch from age(updated_at, created_at)) AS sec FROM jobs WHERE updated_at >= NOW() - INTERVAL '1 HOUR' AND (jobs.status = 'failed' OR jobs.status = 'succeeded' OR jobs.status = 'cancelled'); """; - final var statuses = ctx.fetch(query).getValues("status", JobStatus.class); - final var times = ctx.fetch(query).getValues("sec", double.class); + final var queryResults = ctx.fetch(query); + final var statuses = queryResults.getValues("status", JobStatus.class); + final var times = queryResults.getValues("sec", double.class); final var results = new HashMap(); for (int i = 0; i < statuses.size(); i++) {