cave/activitypub/send: remove histogram instrumentation
This commit is contained in:
parent
669f9b4e52
commit
5b9ff9213f
|
@ -1,9 +1,8 @@
|
|||
use std::{
|
||||
sync::Arc,
|
||||
time::{Instant, SystemTime},
|
||||
time::SystemTime,
|
||||
};
|
||||
use http::StatusCode;
|
||||
use metrics::histogram;
|
||||
use serde::Serialize;
|
||||
use sigh::{PrivateKey, SigningConfig, alg::RsaSha256};
|
||||
use super::{digest, error::Error};
|
||||
|
@ -43,20 +42,14 @@ pub async fn send_raw(
|
|||
.header("digest", digest_header)
|
||||
.body(body.as_ref().clone())
|
||||
.map_err(Error::HttpReq)?;
|
||||
let t1 = Instant::now();
|
||||
SigningConfig::new(RsaSha256, private_key, key_id)
|
||||
.sign(&mut req)?;
|
||||
let t2 = Instant::now();
|
||||
let req: reqwest::Request = req.try_into()?;
|
||||
let res = client.execute(req)
|
||||
.await?;
|
||||
let t3 = Instant::now();
|
||||
histogram!("relay_http_request_duration", t2 - t1);
|
||||
if res.status() >= StatusCode::OK && res.status() < StatusCode::MULTIPLE_CHOICES {
|
||||
histogram!("relay_http_response_duration", t3 - t2, "res" => "ok", "host" => host);
|
||||
Ok(())
|
||||
} else {
|
||||
histogram!("relay_http_response_duration", t3 - t2, "res" => "err", "host" => host);
|
||||
tracing::error!("send_raw {} response HTTP {}", url, res.status());
|
||||
let response = res.text().await?;
|
||||
Err(Error::Response(response))
|
||||
|
|
Loading…
Reference in New Issue