Skip to content

Commit fec4622

Browse files
committed
Add missing dummy instrumentation for AsyncWrapper
1 parent d02798c commit fec4622

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/async_connection_wrapper.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,14 @@ pub type AsyncConnectionWrapper<C, B = self::implementation::Tokio> =
100100
pub use self::implementation::AsyncConnectionWrapper;
101101

102102
mod implementation {
103-
use diesel::connection::SimpleConnection;
103+
use diesel::connection::{Instrumentation, SimpleConnection};
104104

105105
use super::*;
106106

107107
pub struct AsyncConnectionWrapper<C, B> {
108108
inner: C,
109109
runtime: B,
110+
instrumentation: Option<Box<dyn Instrumentation>>,
110111
}
111112

112113
impl<C, B> From<C> for AsyncConnectionWrapper<C, B>
@@ -118,6 +119,7 @@ mod implementation {
118119
Self {
119120
inner,
120121
runtime: B::get_runtime(),
122+
instrumentation: None,
121123
}
122124
}
123125
}
@@ -148,7 +150,11 @@ mod implementation {
148150
let runtime = B::get_runtime();
149151
let f = C::establish(database_url);
150152
let inner = runtime.block_on(f)?;
151-
Ok(Self { inner, runtime })
153+
Ok(Self {
154+
inner,
155+
runtime,
156+
instrumentation: None,
157+
})
152158
}
153159

154160
fn execute_returning_count<T>(&mut self, source: &T) -> diesel::QueryResult<usize>
@@ -164,6 +170,14 @@ mod implementation {
164170
) -> &mut <Self::TransactionManager as diesel::connection::TransactionManager<Self>>::TransactionStateData{
165171
self.inner.transaction_state()
166172
}
173+
174+
fn instrumentation(&mut self) -> &mut dyn Instrumentation {
175+
&mut self.instrumentation
176+
}
177+
178+
fn set_instrumentation(&mut self, instrumentation: impl Instrumentation) {
179+
self.instrumentation = Some(Box::new(instrumentation));
180+
}
167181
}
168182

169183
impl<C, B> diesel::connection::LoadConnection for AsyncConnectionWrapper<C, B>

0 commit comments

Comments
 (0)