diff --git a/Cargo.lock b/Cargo.lock index adfb7b9..3046e53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -810,9 +810,7 @@ dependencies = [ "byteorder", "chrono", "diesel_derives", - "ipnetwork", "itoa 1.0.10", - "libc", "num-bigint", "num-integer", "num-traits", @@ -820,17 +818,6 @@ dependencies = [ "r2d2", ] -[[package]] -name = "diesel-tracing" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "059a68707299bab4730b5c4370798d27b5005f24c7efa830c983009cc2dcbab6" -dependencies = [ - "diesel", - "ipnetwork", - "tracing", -] - [[package]] name = "diesel_derives" version = "2.1.2" @@ -2054,15 +2041,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "ipnetwork" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf466541e9d546596ee94f9f69590f89473455f88372423e0008fc1a7daf100e" -dependencies = [ - "serde", -] - [[package]] name = "iri-string" version = "0.7.0" @@ -3319,7 +3297,6 @@ dependencies = [ "console", "dickens", "diesel", - "diesel-tracing", "dotenv", "env_logger", "futures", diff --git a/server/Cargo.toml b/server/Cargo.toml index d5f1bfc..dec197b 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -36,4 +36,3 @@ opentelemetry = "0.22.0" tracing-opentelemetry = "0.23.0" opentelemetry-otlp = { version = "0.15.0", features = ["http-proto", "reqwest-client"] } opentelemetry_sdk = { version = "0.22.1", features = ["rt-tokio"] } -diesel-tracing = { version = "0.2.3", features = ["postgres", "r2d2"] } diff --git a/server/src/lib.rs b/server/src/lib.rs index 952cdb0..721fbe7 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -1,6 +1,8 @@ use clap::Parser; -use diesel::r2d2::{ConnectionManager, Pool}; -use diesel_tracing::pg::InstrumentedPgConnection; +use diesel::{ + r2d2::{ConnectionManager, Pool}, + PgConnection, +}; use once_cell::sync::Lazy; use std::path::PathBuf; @@ -14,8 +16,7 @@ pub mod recycler; pub mod routes; pub mod schema; -pub type DbConnection = InstrumentedPgConnection; -pub type DbPool = Pool>; +pub type DbPool = Pool>; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] diff --git a/server/src/main.rs b/server/src/main.rs index 37be299..d27eaf9 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -2,6 +2,7 @@ use axum::extract::MatchedPath; use axum::http::Method; use axum::routing::post; use axum::{routing::get, Router}; +use diesel::pg::PgConnection; use diesel::r2d2::ConnectionManager; use diesel::r2d2::Pool; use opentelemetry::KeyValue; @@ -16,7 +17,6 @@ use server::routes::{ }; use server::routes::{pipeline_new, worker_heartbeat}; use server::routes::{pipeline_status, worker_status}; -use server::DbConnection; use server::{DbPool, ARGS}; use teloxide::prelude::*; use tower_http::cors::{Any, CorsLayer}; @@ -60,7 +60,7 @@ async fn main() -> anyhow::Result<()> { } tracing::info!("Connecting to database"); - let manager = ConnectionManager::::new(&ARGS.database_url); + let manager = ConnectionManager::::new(&ARGS.database_url); let pool = Pool::builder().test_on_check_out(true).build(manager)?; let mut handles = vec![]; diff --git a/server/src/routes/job.rs b/server/src/routes/job.rs index 9eb9745..c2963bf 100644 --- a/server/src/routes/job.rs +++ b/server/src/routes/job.rs @@ -1,13 +1,13 @@ use crate::github::get_crab_github_installation; use crate::models::{Job, NewJob, Pipeline, User}; use crate::routes::{AnyhowError, AppState}; -use crate::DbConnection; use anyhow::{bail, Context}; use axum::extract::{Json, Query, State}; use diesel::connection::{AnsiTransactionManager, TransactionManager}; use diesel::r2d2::PoolTransactionManager; use diesel::{ - Connection, ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl, RunQueryDsl, + Connection, ExpressionMethods, JoinOnDsl, NullableExpressionMethods, PgConnection, QueryDsl, + RunQueryDsl, }; use serde::{Deserialize, Serialize}; use tracing::warn; @@ -198,7 +198,7 @@ pub struct JobRestartResponse { } async fn job_restart_in_transaction( payload: &JobRestartRequest, - conn: &mut DbConnection, + conn: &mut PgConnection, ) -> anyhow::Result { let job = crate::schema::jobs::dsl::jobs .find(payload.job_id)