File tree 2 files changed +11
-0
lines changed
crates/application/src/scheduled_jobs 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -45,3 +45,11 @@ register_convex_gauge!(
45
45
pub fn log_scheduled_job_execution_lag ( lag : Duration ) {
46
46
log_gauge ( & SCHEDULED_JOB_EXECUTION_LAG_SECONDS , lag. as_secs_f64 ( ) ) ;
47
47
}
48
+
49
+ register_convex_gauge ! (
50
+ SCHEDULED_JOB_NUM_RUNNING_TOTAL ,
51
+ "Number of currently executing scheduled jobs"
52
+ ) ;
53
+ pub fn log_num_running_jobs ( num_running : usize ) {
54
+ log_gauge ( & SCHEDULED_JOB_NUM_RUNNING_TOTAL , num_running as f64 ) ;
55
+ }
Original file line number Diff line number Diff line change @@ -257,6 +257,7 @@ impl<RT: Runtime> ScheduledJobExecutor<RT> {
257
257
. await ?
258
258
} ;
259
259
260
+ metrics:: log_num_running_jobs ( running_job_ids. len ( ) ) ;
260
261
let next_job_future = if let Some ( next_job_ts) = next_job_ready_time {
261
262
let now = self . rt . generate_timestamp ( ) ?;
262
263
Either :: Left ( if next_job_ts < now {
@@ -265,9 +266,11 @@ impl<RT: Runtime> ScheduledJobExecutor<RT> {
265
266
// track how far we're behind in our metrics.
266
267
self . rt . wait ( Duration :: from_secs ( 5 ) )
267
268
} else {
269
+ metrics:: log_scheduled_job_execution_lag ( Duration :: from_secs ( 0 ) ) ;
268
270
self . rt . wait ( next_job_ts - now)
269
271
} )
270
272
} else {
273
+ metrics:: log_scheduled_job_execution_lag ( Duration :: from_secs ( 0 ) ) ;
271
274
Either :: Right ( std:: future:: pending ( ) )
272
275
} ;
273
276
You can’t perform that action at this time.
0 commit comments