@@ -94,7 +94,7 @@ impl PostgreSQL {
9494 }
9595
9696 /// Get the [status](Status) of the PostgreSQL server
97- #[ instrument( level = "debug" ) ]
97+ #[ instrument( level = "debug" , skip ( self ) ) ]
9898 pub fn status ( & self ) -> Status {
9999 if self . is_running ( ) {
100100 Status :: Started
@@ -141,7 +141,7 @@ impl PostgreSQL {
141141 /// Set up the database by extracting the archive and initializing the database.
142142 /// If the installation directory already exists, the archive will not be extracted.
143143 /// If the data directory already exists, the database will not be initialized.
144- #[ instrument]
144+ #[ instrument( skip ( self ) ) ]
145145 pub async fn setup ( & mut self ) -> Result < ( ) > {
146146 if !self . is_installed ( ) {
147147 self . install ( ) . await ?;
@@ -159,7 +159,7 @@ impl PostgreSQL {
159159 /// hash does not match the expected hash, an error will be returned. If the installation directory
160160 /// already exists, the archive will not be extracted. If the archive is not found, an error will be
161161 /// returned.
162- #[ instrument]
162+ #[ instrument( skip ( self ) ) ]
163163 async fn install ( & mut self ) -> Result < ( ) > {
164164 debug ! ( "Starting installation process for version {}" , self . version) ;
165165
@@ -208,7 +208,7 @@ impl PostgreSQL {
208208
209209 /// Initialize the database in the data directory. This will create the necessary files and
210210 /// directories to start the database.
211- #[ instrument]
211+ #[ instrument( skip ( self ) ) ]
212212 async fn initialize ( & mut self ) -> Result < ( ) > {
213213 if !self . settings . password_file . exists ( ) {
214214 let mut file = std:: fs:: File :: create ( & self . settings . password_file ) ?;
@@ -241,7 +241,7 @@ impl PostgreSQL {
241241
242242 /// Start the database and wait for the startup to complete.
243243 /// If the port is set to `0`, the database will be started on a random port.
244- #[ instrument]
244+ #[ instrument( skip ( self ) ) ]
245245 pub async fn start ( & mut self ) -> Result < ( ) > {
246246 if self . settings . port == 0 {
247247 let listener = TcpListener :: bind ( ( "0.0.0.0" , 0 ) ) ?;
@@ -276,7 +276,7 @@ impl PostgreSQL {
276276 }
277277
278278 /// Stop the database gracefully (smart mode) and wait for the shutdown to complete.
279- #[ instrument]
279+ #[ instrument( skip ( self ) ) ]
280280 pub async fn stop ( & self ) -> Result < ( ) > {
281281 debug ! (
282282 "Stopping database {}" ,
@@ -301,8 +301,11 @@ impl PostgreSQL {
301301 }
302302
303303 /// 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+ {
306309 debug ! (
307310 "Creating database {} for {}:{}" ,
308311 database_name. as_ref( ) ,
@@ -329,8 +332,11 @@ impl PostgreSQL {
329332 }
330333
331334 /// 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+ {
334340 debug ! (
335341 "Checking if database {} exists for {}:{}" ,
336342 database_name. as_ref( ) ,
@@ -356,8 +362,11 @@ impl PostgreSQL {
356362 }
357363
358364 /// 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+ {
361370 debug ! (
362371 "Dropping database {} for {}:{}" ,
363372 database_name. as_ref( ) ,
@@ -398,7 +407,7 @@ impl PostgreSQL {
398407
399408 #[ cfg( feature = "tokio" ) ]
400409 /// 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 ( ) ) ) ]
402411 async fn execute_command < B : CommandBuilder > (
403412 & self ,
404413 command_builder : B ,
0 commit comments