This repository was archived by the owner on Jun 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use std::collections;
2
2
use std:: sync:: Arc ;
3
3
use std:: time;
4
4
5
+ use chrono:: Utc ;
5
6
use futures:: future:: join_all;
6
7
use hook_common:: health:: HealthHandle ;
7
8
use hook_common:: pgqueue:: PgTransactionBatch ;
@@ -234,11 +235,24 @@ async fn process_webhook_job<W: WebhookJob>(
234
235
235
236
match send_result {
236
237
Ok ( _) => {
238
+ let created_at = webhook_job. job ( ) . created_at ;
239
+ let retries = webhook_job. job ( ) . attempt - 1 ;
240
+ let labels_with_retries = [
241
+ ( "queue" , webhook_job. queue ( ) ) ,
242
+ ( "retries" , retries. to_string ( ) ) ,
243
+ ] ;
244
+
237
245
webhook_job. complete ( ) . await . map_err ( |error| {
238
246
metrics:: counter!( "webhook_jobs_database_error" , & labels) . increment ( 1 ) ;
239
247
error
240
248
} ) ?;
241
249
250
+ let insert_to_complete_duration = Utc :: now ( ) - created_at;
251
+ metrics:: histogram!(
252
+ "webhook_jobs_insert_to_complete_duration_seconds" ,
253
+ & labels_with_retries
254
+ )
255
+ . record ( ( insert_to_complete_duration. num_milliseconds ( ) as f64 ) / 1_000_f64 ) ;
242
256
metrics:: counter!( "webhook_jobs_completed" , & labels) . increment ( 1 ) ;
243
257
metrics:: histogram!( "webhook_jobs_processing_duration_seconds" , & labels)
244
258
. record ( elapsed) ;
You can’t perform that action at this time.
0 commit comments