@@ -35,9 +35,7 @@ pub struct AsyncMysqlConnection {
35
35
#[ async_trait:: async_trait]
36
36
impl SimpleAsyncConnection for AsyncMysqlConnection {
37
37
async fn batch_execute ( & mut self , query : & str ) -> diesel:: QueryResult < ( ) > {
38
- self . instrumentation
39
- . lock ( )
40
- . unwrap_or_else ( |p| p. into_inner ( ) )
38
+ self . instrumentation ( )
41
39
. on_connection_event ( InstrumentationEvent :: start_query ( & StrQueryHelper :: new (
42
40
query,
43
41
) ) ) ;
@@ -47,9 +45,7 @@ impl SimpleAsyncConnection for AsyncMysqlConnection {
47
45
. await
48
46
. map_err ( ErrorHelper )
49
47
. map_err ( Into :: into) ;
50
- self . instrumentation
51
- . lock ( )
52
- . unwrap_or_else ( |p| p. into_inner ( ) )
48
+ self . instrumentation ( )
53
49
. on_connection_event ( InstrumentationEvent :: finish_query (
54
50
& StrQueryHelper :: new ( query) ,
55
51
result. as_ref ( ) . err ( ) ,
@@ -232,7 +228,9 @@ impl AsyncMysqlConnection {
232
228
conn,
233
229
stmt_cache : StmtCache :: new ( ) ,
234
230
transaction_manager : AnsiTransactionManager :: default ( ) ,
235
- instrumentation : std:: sync:: Mutex :: new ( None ) ,
231
+ instrumentation : std:: sync:: Mutex :: new (
232
+ diesel:: connection:: get_default_instrumentation ( ) ,
233
+ ) ,
236
234
} ;
237
235
238
236
for stmt in CONNECTION_SETUP_QUERIES {
@@ -257,9 +255,7 @@ impl AsyncMysqlConnection {
257
255
T : QueryFragment < Mysql > + QueryId ,
258
256
F : Future < Output = QueryResult < R > > + Send ,
259
257
{
260
- self . instrumentation
261
- . lock ( )
262
- . unwrap_or_else ( |p| p. into_inner ( ) )
258
+ self . instrumentation ( )
263
259
. on_connection_event ( InstrumentationEvent :: start_query ( & diesel:: debug_query (
264
260
& query,
265
261
) ) ) ;
@@ -272,7 +268,7 @@ impl AsyncMysqlConnection {
272
268
ref mut conn,
273
269
ref mut stmt_cache,
274
270
ref mut transaction_manager,
275
- ref instrumentation,
271
+ ref mut instrumentation,
276
272
..
277
273
} = self ;
278
274
@@ -311,7 +307,7 @@ impl AsyncMysqlConnection {
311
307
} ;
312
308
let r = update_transaction_manager_status ( inner. await , transaction_manager) ;
313
309
instrumentation
314
- . lock ( )
310
+ . get_mut ( )
315
311
. unwrap_or_else ( |p| p. into_inner ( ) )
316
312
. on_connection_event ( InstrumentationEvent :: finish_query (
317
313
& StrQueryHelper :: new ( & sql) ,
0 commit comments