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

Add histogram for insertion time to completion time #5

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 futures::future::join_all;
use hook_common::health::HealthHandle;
use hook_common::pgqueue::PgTransactionBatch;
Expand Down Expand Up @@ -234,6 +235,10 @@ async fn process_webhook_job<W: WebhookJob>(

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

webhook_job.complete().await.map_err(|error| {
metrics::counter!("webhook_jobs_database_error", &labels).increment(1);
error
Expand Down
Loading