Skip to content

Commit

Permalink
Emit orphan running jobs metrics (#13865)
Browse files Browse the repository at this point in the history
That metrics show the number of jobs currently flagged as running that
are associated to inactive or deprecated connections.
  • Loading branch information
malikdiarra committed Jun 16, 2022
1 parent 091c5bc commit 40d58cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public enum OssMetricsRegistry implements MetricsRegistry {
MetricEmittingApps.METRICS_REPORTER,
"num_running_jobs",
"number of running jobs"),
NUM_ORPHAN_RUNNING_JOBS(
MetricEmittingApps.METRICS_REPORTER,
"num_orphan_running_jobs",
"number of jobs reported as running that as associated to connection inactive or deprecated"),
NUM_ACTIVE_CONN_PER_WORKSPACE(
MetricEmittingApps.METRICS_REPORTER,
"num_active_conn_per_workspace",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public enum ToEmit {
final var runningJobs = ReporterApp.configDatabase.query(MetricQueries::numberOfRunningJobs);
MetricClientFactory.getMetricClient().gauge(OssMetricsRegistry.NUM_RUNNING_JOBS, runningJobs);
})),
NUM_ORPHAN_RUNNING_JOB(countMetricEmission(() -> {
final var orphanRunningJobs = ReporterApp.configDatabase.query(MetricQueries::numberOfOrphanRunningJobs);
MetricClientFactory.getMetricClient().gauge(OssMetricsRegistry.NUM_ORPHAN_RUNNING_JOBS, orphanRunningJobs);
})),
OLDEST_RUNNING_JOB_AGE_SECS(countMetricEmission(() -> {
final var age = ReporterApp.configDatabase.query(MetricQueries::oldestRunningJobAgeSecs);
MetricClientFactory.getMetricClient().gauge(OssMetricsRegistry.OLDEST_RUNNING_JOB_AGE_SECS, age);
Expand Down

0 comments on commit 40d58cc

Please sign in to comment.