Skip to content

Commit

Permalink
Revert "feat: enable tracing for diesel"
Browse files Browse the repository at this point in the history
This reverts commit 09a539f.
  • Loading branch information
jiegec committed Mar 17, 2024
1 parent 09a539f commit 279f9c6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 33 deletions.
23 changes: 0 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
9 changes: 5 additions & 4 deletions server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -14,8 +16,7 @@ pub mod recycler;
pub mod routes;
pub mod schema;

pub type DbConnection = InstrumentedPgConnection;
pub type DbPool = Pool<ConnectionManager<DbConnection>>;
pub type DbPool = Pool<ConnectionManager<PgConnection>>;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
Expand Down
4 changes: 2 additions & 2 deletions server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand Down Expand Up @@ -60,7 +60,7 @@ async fn main() -> anyhow::Result<()> {
}

tracing::info!("Connecting to database");
let manager = ConnectionManager::<DbConnection>::new(&ARGS.database_url);
let manager = ConnectionManager::<PgConnection>::new(&ARGS.database_url);
let pool = Pool::builder().test_on_check_out(true).build(manager)?;

let mut handles = vec![];
Expand Down
6 changes: 3 additions & 3 deletions server/src/routes/job.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -198,7 +198,7 @@ pub struct JobRestartResponse {
}
async fn job_restart_in_transaction(
payload: &JobRestartRequest,
conn: &mut DbConnection,
conn: &mut PgConnection,
) -> anyhow::Result<Job> {
let job = crate::schema::jobs::dsl::jobs
.find(payload.job_id)
Expand Down

0 comments on commit 279f9c6

Please sign in to comment.