@@ -100,13 +100,14 @@ pub type AsyncConnectionWrapper<C, B = self::implementation::Tokio> =
100
100
pub use self :: implementation:: AsyncConnectionWrapper ;
101
101
102
102
mod implementation {
103
- use diesel:: connection:: SimpleConnection ;
103
+ use diesel:: connection:: { Instrumentation , SimpleConnection } ;
104
104
105
105
use super :: * ;
106
106
107
107
pub struct AsyncConnectionWrapper < C , B > {
108
108
inner : C ,
109
109
runtime : B ,
110
+ instrumentation : Option < Box < dyn Instrumentation > > ,
110
111
}
111
112
112
113
impl < C , B > From < C > for AsyncConnectionWrapper < C , B >
@@ -118,6 +119,7 @@ mod implementation {
118
119
Self {
119
120
inner,
120
121
runtime : B :: get_runtime ( ) ,
122
+ instrumentation : None ,
121
123
}
122
124
}
123
125
}
@@ -148,7 +150,11 @@ mod implementation {
148
150
let runtime = B :: get_runtime ( ) ;
149
151
let f = C :: establish ( database_url) ;
150
152
let inner = runtime. block_on ( f) ?;
151
- Ok ( Self { inner, runtime } )
153
+ Ok ( Self {
154
+ inner,
155
+ runtime,
156
+ instrumentation : None ,
157
+ } )
152
158
}
153
159
154
160
fn execute_returning_count < T > ( & mut self , source : & T ) -> diesel:: QueryResult < usize >
@@ -164,6 +170,14 @@ mod implementation {
164
170
) -> & mut <Self :: TransactionManager as diesel:: connection:: TransactionManager < Self > >:: TransactionStateData {
165
171
self . inner . transaction_state ( )
166
172
}
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
+ }
167
181
}
168
182
169
183
impl < C , B > diesel:: connection:: LoadConnection for AsyncConnectionWrapper < C , B >
0 commit comments