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 < ' a > (
5152 mas_connection : & mut LockedMasDatabase < ' a > ,
5253) -> Result < ( ) , Error > {
@@ -62,8 +63,11 @@ pub async fn mas_pre_migration_checks<'a>(
6263 // empty database.
6364
6465 for & table in MAS_TABLES_AFFECTED_BY_MIGRATION {
65- let row_present = sqlx:: query ( & format ! ( "SELECT 1 AS dummy FROM {table} LIMIT 1" ) )
66+ let query = format ! ( "SELECT 1 AS dummy FROM {table} LIMIT 1" ) ;
67+ let span = tracing:: info_span!( "db.query" , db. query. text = query) ;
68+ let row_present = sqlx:: query ( & query)
6669 . fetch_optional ( mas_connection. as_mut ( ) )
70+ . instrument ( span)
6771 . await
6872 . into_maybe_not_mas ( table) ?
6973 . 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<'conn> MasWriter<'conn> {
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 < ' conn > ,
393393 mut writer_connections : Vec < PgConnection > ,
You can’t perform that action at this time.
0 commit comments