diff --git a/Cargo.lock b/Cargo.lock index 9a9150d..1ce94e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -470,15 +470,6 @@ dependencies = [ "bytes", ] -[[package]] -name = "cadence" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62fd689c825a93386a2ac05a46f88342c6df9ec3e79416f665650614e92e7475" -dependencies = [ - "crossbeam-channel", -] - [[package]] name = "camino" version = "1.1.9" @@ -3575,7 +3566,6 @@ dependencies = [ "actix-web-lab", "anyhow", "badge", - "cadence", "crates-index", "derive_more 1.0.0", "dotenvy", diff --git a/Cargo.toml b/Cargo.toml index 17605ec..38eb6c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ badge = { path = "./libs/badge" } actix-web = "4" actix-web-lab = "0.23" anyhow = "1" -cadence = "1" crates-index = { version = "3", default-features = false, features = ["git"] } derive_more = { version = "1", features = ["display", "error", "from"] } dotenvy = "0.15" diff --git a/src/engine/mod.rs b/src/engine/mod.rs index 2e53a5f..e637623 100644 --- a/src/engine/mod.rs +++ b/src/engine/mod.rs @@ -1,13 +1,11 @@ use std::{ collections::HashSet, - panic::RefUnwindSafe, sync::{Arc, LazyLock}, time::{Duration, Instant}, }; use actix_web::dev::Service; use anyhow::{anyhow, Error}; -use cadence::{MetricSink, NopMetricSink, StatsdClient}; use futures_util::{ future::try_join_all, stream::{self, LocalBoxStream}, @@ -39,7 +37,6 @@ use self::fut::{analyze_dependencies, crawl_manifest}; #[derive(Debug, Clone)] pub struct Engine { - metrics: Arc, query_crate: Cache, get_popular_crates: Cache, get_popular_repos: Cache, @@ -49,8 +46,6 @@ pub struct Engine { impl Engine { pub fn new(client: reqwest::Client, index: ManagedIndex) -> Engine { - let metrics = Arc::new(StatsdClient::from_sink("engine", NopMetricSink)); - let query_crate = Cache::new(QueryCrate::new(index), Duration::from_secs(10), 500); let get_popular_crates = Cache::new( GetPopularCrates::new(client.clone()), @@ -70,7 +65,6 @@ impl Engine { ); Engine { - metrics, query_crate, get_popular_crates, get_popular_repos, @@ -78,10 +72,6 @@ impl Engine { fetch_advisory_db, } } - - pub fn set_metrics(&mut self, sink: M) { - self.metrics = Arc::new(StatsdClient::from_sink("engine", sink)); - } } #[derive(Debug)] diff --git a/src/main.rs b/src/main.rs index 4089e2d..a31302f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,18 +1,13 @@ #![deny(rust_2018_idioms)] #![warn(missing_debug_implementations)] -use std::{ - env, - net::{Ipv4Addr, UdpSocket}, - time::Duration, -}; +use std::{env, net::Ipv4Addr, time::Duration}; use actix_web::{ middleware::Logger, web::{self, ThinData}, }; use actix_web_lab::middleware::NormalizePath; -use cadence::{QueuingMetricSink, UdpMetricSink}; use reqwest::redirect::Policy as RedirectPolicy; mod engine; @@ -26,14 +21,6 @@ use self::{engine::Engine, utils::index::ManagedIndex}; const DEPS_RS_UA: &str = "deps.rs"; -fn init_metrics() -> QueuingMetricSink { - let socket = UdpSocket::bind("0.0.0.0:0").unwrap(); - socket.set_nonblocking(true).unwrap(); - let host = ("127.0.0.1", 8125); - let sink = UdpMetricSink::from(host, socket).unwrap(); - QueuingMetricSink::from(sink) -} - fn init_tracing_subscriber() { use tracing::level_filters::LevelFilter; use tracing_subscriber::{fmt, prelude::*, EnvFilter}; @@ -57,7 +44,6 @@ fn init_tracing_subscriber() { async fn main() { dotenvy::dotenv().ok(); init_tracing_subscriber(); - let metrics = init_metrics(); let client = reqwest::Client::builder() .user_agent(DEPS_RS_UA) @@ -81,8 +67,7 @@ async fn main() { }); } - let mut engine = Engine::new(client.clone(), index); - engine.set_metrics(metrics); + let engine = Engine::new(client.clone(), index); let server = actix_web::HttpServer::new(move || { actix_web::App::new()