@@ -94,7 +94,7 @@ impl PostgreSQL {
94
94
}
95
95
96
96
/// Get the [status](Status) of the PostgreSQL server
97
- #[ instrument( level = "debug" ) ]
97
+ #[ instrument( level = "debug" , skip ( self ) ) ]
98
98
pub fn status ( & self ) -> Status {
99
99
if self . is_running ( ) {
100
100
Status :: Started
@@ -141,7 +141,7 @@ impl PostgreSQL {
141
141
/// Set up the database by extracting the archive and initializing the database.
142
142
/// If the installation directory already exists, the archive will not be extracted.
143
143
/// If the data directory already exists, the database will not be initialized.
144
- #[ instrument]
144
+ #[ instrument( skip ( self ) ) ]
145
145
pub async fn setup ( & mut self ) -> Result < ( ) > {
146
146
if !self . is_installed ( ) {
147
147
self . install ( ) . await ?;
@@ -159,7 +159,7 @@ impl PostgreSQL {
159
159
/// hash does not match the expected hash, an error will be returned. If the installation directory
160
160
/// already exists, the archive will not be extracted. If the archive is not found, an error will be
161
161
/// returned.
162
- #[ instrument]
162
+ #[ instrument( skip ( self ) ) ]
163
163
async fn install ( & mut self ) -> Result < ( ) > {
164
164
debug ! ( "Starting installation process for version {}" , self . version) ;
165
165
@@ -208,7 +208,7 @@ impl PostgreSQL {
208
208
209
209
/// Initialize the database in the data directory. This will create the necessary files and
210
210
/// directories to start the database.
211
- #[ instrument]
211
+ #[ instrument( skip ( self ) ) ]
212
212
async fn initialize ( & mut self ) -> Result < ( ) > {
213
213
if !self . settings . password_file . exists ( ) {
214
214
let mut file = std:: fs:: File :: create ( & self . settings . password_file ) ?;
@@ -241,7 +241,7 @@ impl PostgreSQL {
241
241
242
242
/// Start the database and wait for the startup to complete.
243
243
/// If the port is set to `0`, the database will be started on a random port.
244
- #[ instrument]
244
+ #[ instrument( skip ( self ) ) ]
245
245
pub async fn start ( & mut self ) -> Result < ( ) > {
246
246
if self . settings . port == 0 {
247
247
let listener = TcpListener :: bind ( ( "0.0.0.0" , 0 ) ) ?;
@@ -276,7 +276,7 @@ impl PostgreSQL {
276
276
}
277
277
278
278
/// Stop the database gracefully (smart mode) and wait for the shutdown to complete.
279
- #[ instrument]
279
+ #[ instrument( skip ( self ) ) ]
280
280
pub async fn stop ( & self ) -> Result < ( ) > {
281
281
debug ! (
282
282
"Stopping database {}" ,
@@ -301,8 +301,11 @@ impl PostgreSQL {
301
301
}
302
302
303
303
/// Create a new database with the given name.
304
- #[ instrument( skip( database_name) ) ]
305
- pub async fn create_database < S : AsRef < str > > ( & self , database_name : S ) -> Result < ( ) > {
304
+ #[ instrument( skip( self ) ) ]
305
+ pub async fn create_database < S > ( & self , database_name : S ) -> Result < ( ) >
306
+ where
307
+ S : AsRef < str > + std:: fmt:: Debug ,
308
+ {
306
309
debug ! (
307
310
"Creating database {} for {}:{}" ,
308
311
database_name. as_ref( ) ,
@@ -329,8 +332,11 @@ impl PostgreSQL {
329
332
}
330
333
331
334
/// Check if a database with the given name exists.
332
- #[ instrument( skip( database_name) ) ]
333
- pub async fn database_exists < S : AsRef < str > > ( & self , database_name : S ) -> Result < bool > {
335
+ #[ instrument( skip( self ) ) ]
336
+ pub async fn database_exists < S > ( & self , database_name : S ) -> Result < bool >
337
+ where
338
+ S : AsRef < str > + std:: fmt:: Debug ,
339
+ {
334
340
debug ! (
335
341
"Checking if database {} exists for {}:{}" ,
336
342
database_name. as_ref( ) ,
@@ -356,8 +362,11 @@ impl PostgreSQL {
356
362
}
357
363
358
364
/// Drop a database with the given name.
359
- #[ instrument( skip( database_name) ) ]
360
- pub async fn drop_database < S : AsRef < str > > ( & self , database_name : S ) -> Result < ( ) > {
365
+ #[ instrument( skip( self ) ) ]
366
+ pub async fn drop_database < S > ( & self , database_name : S ) -> Result < ( ) >
367
+ where
368
+ S : AsRef < str > + std:: fmt:: Debug ,
369
+ {
361
370
debug ! (
362
371
"Dropping database {} for {}:{}" ,
363
372
database_name. as_ref( ) ,
@@ -398,7 +407,7 @@ impl PostgreSQL {
398
407
399
408
#[ cfg( feature = "tokio" ) ]
400
409
/// Execute a command and return the stdout and stderr as strings.
401
- #[ instrument( level = "debug" ) ]
410
+ #[ instrument( level = "debug" , skip ( self , command_builder ) , fields ( program = ?command_builder . get_program ( ) ) ) ]
402
411
async fn execute_command < B : CommandBuilder > (
403
412
& self ,
404
413
command_builder : B ,
0 commit comments