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 {
80
80
const NUM_WRITER_CONNECTIONS : usize = 8 ;
81
81
82
82
impl Options {
83
+ #[ tracing:: instrument( "cli.syn2mas.run" , skip_all) ]
83
84
#[ allow( clippy:: too_many_lines) ]
84
85
pub async fn run ( self , figment : & Figment ) -> anyhow:: Result < ExitCode > {
85
86
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 10
10
11
11
use thiserror:: Error ;
12
12
use thiserror_ext:: ContextInto ;
13
+ use tracing:: Instrument as _;
13
14
14
15
use super :: { is_syn2mas_in_progress, locking:: LockedMasDatabase , MAS_TABLES_AFFECTED_BY_MIGRATION } ;
15
16
@@ -46,7 +47,7 @@ pub enum Error {
46
47
/// - If any MAS tables involved in the migration are not empty.
47
48
/// - If we can't check whether syn2mas is already in progress on this database
48
49
/// or not.
49
- #[ tracing:: instrument( skip_all) ]
50
+ #[ tracing:: instrument( name = "syn2mas.mas_pre_migration_checks" , skip_all) ]
50
51
pub async fn mas_pre_migration_checks < ' a > (
51
52
mas_connection : & mut LockedMasDatabase < ' a > ,
52
53
) -> Result < ( ) , Error > {
@@ -62,8 +63,11 @@ pub async fn mas_pre_migration_checks<'a>(
62
63
// empty database.
63
64
64
65
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)
66
69
. fetch_optional ( mas_connection. as_mut ( ) )
70
+ . instrument ( span)
67
71
. await
68
72
. into_maybe_not_mas ( table) ?
69
73
. is_some ( ) ;
Original file line number Diff line number Diff line change @@ -123,6 +123,8 @@ pub async fn restore_constraint(
123
123
table_name,
124
124
definition,
125
125
} = & constraint;
126
+ info ! ( "rebuilding constraint {name}" ) ;
127
+
126
128
sqlx:: query ( & format ! (
127
129
"ALTER TABLE {table_name} ADD CONSTRAINT {name} {definition};"
128
130
) )
Original file line number Diff line number Diff line change @@ -387,7 +387,7 @@ impl<'conn> MasWriter<'conn> {
387
387
///
388
388
/// - If the database connection experiences an error.
389
389
#[ allow( clippy:: missing_panics_doc) ] // not real
390
- #[ tracing:: instrument( skip_all) ]
390
+ #[ tracing:: instrument( name = "syn2mas.mas_writer.new" , skip_all) ]
391
391
pub async fn new (
392
392
mut conn : LockedMasDatabase < ' conn > ,
393
393
mut writer_connections : Vec < PgConnection > ,
You can’t perform that action at this time.
0 commit comments