Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Add histogram for insertion time to completion time
Browse files Browse the repository at this point in the history
  • Loading branch information
bretthoerner committed Feb 6, 2024
1 parent 304852c commit e434877
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hook-worker/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::collections;
use std::sync::Arc;
use std::time;

use chrono::Utc;
use hook_common::health::HealthHandle;
use hook_common::{
pgqueue::{Job, PgJob, PgJobError, PgQueue, PgQueueError, PgQueueJob, PgTransactionJob},
Expand Down Expand Up @@ -264,6 +265,10 @@ async fn process_webhook_job<W: WebhookJob>(

match send_result {
Ok(_) => {
let insert_to_complete_duration = Utc::now() - webhook_job.job().created_at;
metrics::histogram!("webhook_jobs_insert_to_complete_duration_seconds", &labels)
.record((insert_to_complete_duration.num_milliseconds() as f64) / 1_000_f64);

webhook_job
.complete()
.await
Expand Down

0 comments on commit e434877

Please sign in to comment.