diff --git a/src/db.rs b/src/db.rs index 54bd56d..f249770 100644 --- a/src/db.rs +++ b/src/db.rs @@ -62,7 +62,7 @@ impl Database { self.inner.client.execute(&self.inner.add_follow, &[&id, &inbox, &actor]) .await?; let t2 = Instant::now(); - histogram!("sql", t2 - t1, "query" => "add_follow"); + histogram!("postgres_query_duration", t2 - t1, "query" => "add_follow"); Ok(()) } @@ -71,7 +71,7 @@ impl Database { self.inner.client.execute(&self.inner.del_follow, &[&id, &actor]) .await?; let t2 = Instant::now(); - histogram!("sql", t2 - t1, "query" => "del_follow"); + histogram!("postgres_query_duration", t2 - t1, "query" => "del_follow"); Ok(()) } @@ -80,7 +80,7 @@ impl Database { let rows = self.inner.client.query(&self.inner.get_following_inboxes, &[&actor]) .await?; let t2 = Instant::now(); - histogram!("sql", t2 - t1, "query" => "get_following_inboxes"); + histogram!("postgres_query_duration", t2 - t1, "query" => "get_following_inboxes"); Ok(rows.into_iter() .map(|row| row.get(0)) ) diff --git a/src/main.rs b/src/main.rs index c631d5f..f982144 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,7 +42,7 @@ impl FromRef for Arc { } fn track_request(method: &'static str, controller: &'static str, result: &'static str) { - increment_counter!("request", "controller" => controller, "method" => method, "result" => result); + increment_counter!("api_http_requests_total", "controller" => controller, "method" => method, "result" => result); } async fn webfinger( diff --git a/src/relay.rs b/src/relay.rs index 4a6ff94..d402059 100644 --- a/src/relay.rs +++ b/src/relay.rs @@ -84,7 +84,7 @@ pub fn spawn( Some(url) => url, // skip reposts None => { - increment_counter!("post", "action" => "skip"); + increment_counter!("relay_posts_total", "action" => "skip"); continue; } }; @@ -119,7 +119,6 @@ pub fn spawn( let private_key_ = private_key.clone(); tracing::debug!("relay {} from {} to {}", &post_url, actor_id, inbox); tokio::spawn(async move { - increment_counter!("relay", "target" => inbox.clone()); if let Err(e) = send::send_raw( &client_, &inbox, &key_id, &private_key_, body_ @@ -139,12 +138,12 @@ pub fn spawn( seen_actors.insert(actor); } if seen_inboxes.is_empty() { - increment_counter!("post", "action" => "no_relay"); + increment_counter!("relay_posts_total", "action" => "no_relay"); } else { - increment_counter!("post", "action" => "relay"); + increment_counter!("relay_posts_total", "action" => "relay"); } let t2 = Instant::now(); - histogram!("relay_post", t2 - t1); + histogram!("relay_post_duration", t2 - t1); } }); } diff --git a/src/send.rs b/src/send.rs index 21067a2..53d93d8 100644 --- a/src/send.rs +++ b/src/send.rs @@ -81,12 +81,12 @@ pub async fn send_raw( let res = client.execute(req) .await?; let t3 = Instant::now(); - histogram!("sign_req", t2 - t1); + histogram!("relay_http_request_duration", t2 - t1); if res.status() >= StatusCode::OK && res.status() < StatusCode::MULTIPLE_CHOICES { - histogram!("req", t3 - t2, "res" => "ok", "host" => host); + histogram!("relay_http_response_duration", t3 - t2, "res" => "ok", "host" => host); Ok(()) } else { - histogram!("req", t3 - t2, "res" => "err", "host" => host); + histogram!("relay_http_response_duration", t3 - t2, "res" => "err", "host" => host); let response = res.text().await?; Err(SendError::Response(response)) }