File tree Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ enum Subcommand {
8080const NUM_WRITER_CONNECTIONS : usize = 8 ;
8181
8282impl Options {
83+ #[ tracing:: instrument( "cli.syn2mas.run" , skip_all) ]
8384 #[ allow( clippy:: too_many_lines) ]
8485 pub async fn run ( self , figment : & Figment ) -> anyhow:: Result < ExitCode > {
8586 warn ! ( "This version of the syn2mas tool is EXPERIMENTAL and INCOMPLETE. Do not use it, except for TESTING." ) ;
Original file line number Diff line number Diff line change 1010
1111use thiserror:: Error ;
1212use thiserror_ext:: ContextInto ;
13+ use tracing:: Instrument as _;
1314
1415use super :: { is_syn2mas_in_progress, locking:: LockedMasDatabase , MAS_TABLES_AFFECTED_BY_MIGRATION } ;
1516
@@ -46,7 +47,7 @@ pub enum Error {
4647/// - If any MAS tables involved in the migration are not empty.
4748/// - If we can't check whether syn2mas is already in progress on this database
4849/// or not.
49- #[ tracing:: instrument( skip_all) ]
50+ #[ tracing:: instrument( name = "syn2mas.mas_pre_migration_checks" , skip_all) ]
5051pub async fn mas_pre_migration_checks ( mas_connection : & mut LockedMasDatabase ) -> Result < ( ) , Error > {
5152 if is_syn2mas_in_progress ( mas_connection. as_mut ( ) )
5253 . await
@@ -60,8 +61,11 @@ pub async fn mas_pre_migration_checks(mas_connection: &mut LockedMasDatabase) ->
6061 // empty database.
6162
6263 for & table in MAS_TABLES_AFFECTED_BY_MIGRATION {
63- let row_present = sqlx:: query ( & format ! ( "SELECT 1 AS dummy FROM {table} LIMIT 1" ) )
64+ let query = format ! ( "SELECT 1 AS dummy FROM {table} LIMIT 1" ) ;
65+ let span = tracing:: info_span!( "db.query" , db. query. text = query) ;
66+ let row_present = sqlx:: query ( & query)
6467 . fetch_optional ( mas_connection. as_mut ( ) )
68+ . instrument ( span)
6569 . await
6670 . into_maybe_not_mas ( table) ?
6771 . is_some ( ) ;
Original file line number Diff line number Diff line change @@ -123,6 +123,8 @@ pub async fn restore_constraint(
123123 table_name,
124124 definition,
125125 } = & constraint;
126+ info ! ( "rebuilding constraint {name}" ) ;
127+
126128 sqlx:: query ( & format ! (
127129 "ALTER TABLE {table_name} ADD CONSTRAINT {name} {definition};"
128130 ) )
Original file line number Diff line number Diff line change @@ -387,7 +387,7 @@ impl MasWriter {
387387 ///
388388 /// - If the database connection experiences an error.
389389 #[ allow( clippy:: missing_panics_doc) ] // not real
390- #[ tracing:: instrument( skip_all) ]
390+ #[ tracing:: instrument( name = "syn2mas.mas_writer.new" , skip_all) ]
391391 pub async fn new (
392392 mut conn : LockedMasDatabase ,
393393 mut writer_connections : Vec < PgConnection > ,
You can’t perform that action at this time.
0 commit comments