Skip to content

Commit

Permalink
fix metric reporter not producing metrics (airbytehq#17863)
Browse files Browse the repository at this point in the history
* init metric client before fetching it

* move init to Application

* semi-colon

* remove double query
  • Loading branch information
colesnodgrass authored Oct 11, 2022
1 parent 4652173 commit 63e39e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -14,6 +16,7 @@
public class Application {

public static void main(final String[] args) {
MetricClientFactory.initialize(MetricEmittingApps.METRICS_REPORTER);
Micronaut.run(Application.class, args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<JobStatus, Double>();
for (int i = 0; i < statuses.size(); i++) {
Expand Down

0 comments on commit 63e39e6

Please sign in to comment.