From 7df6f3906e8865e77168e12040a4d61489c5fbd0 Mon Sep 17 00:00:00 2001 From: asonix Date: Wed, 20 Sep 2023 19:29:19 -0500 Subject: [PATCH] Add timeout, metrics to external validation request --- src/ingest.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ingest.rs b/src/ingest.rs index 062c82f..2baeb3b 100644 --- a/src/ingest.rs +++ b/src/ingest.rs @@ -1,10 +1,11 @@ -use std::sync::Arc; +use std::{sync::Arc, time::Duration}; use crate::{ bytes_stream::BytesStream, either::Either, error::{Error, UploadError}, formats::{InternalFormat, Validations}, + future::WithMetrics, repo::{Alias, ArcRepo, DeleteToken, Hash}, store::Store, }; @@ -122,10 +123,12 @@ where let response = client .post(endpoint.as_str()) + .timeout(Duration::from_secs(media.external_validation_timeout)) .header("Content-Type", input_type.media_type().as_ref()) .body(Body::wrap_stream(crate::stream::make_send(stream))) .send() .instrument(tracing::info_span!("external-validation")) + .with_metrics("pict-rs.ingest.external-validation") .await?; if !response.status().is_success() {