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 ! (
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 :: { MAS_TABLES_AFFECTED_BY_MIGRATION , is_syn2mas_in_progress, locking:: LockedMasDatabase } ;
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 ( mas_connection : & mut LockedMasDatabase ) -> Result < ( ) , Error > {
51
52
if is_syn2mas_in_progress ( mas_connection. as_mut ( ) )
52
53
. await
@@ -60,8 +61,11 @@ pub async fn mas_pre_migration_checks(mas_connection: &mut LockedMasDatabase) ->
60
61
// empty database.
61
62
62
63
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)
64
67
. fetch_optional ( mas_connection. as_mut ( ) )
68
+ . instrument ( span)
65
69
. await
66
70
. into_maybe_not_mas ( table) ?
67
71
. 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 @@ -390,7 +390,7 @@ impl MasWriter {
390
390
///
391
391
/// - If the database connection experiences an error.
392
392
#[ allow( clippy:: missing_panics_doc) ] // not real
393
- #[ tracing:: instrument( skip_all) ]
393
+ #[ tracing:: instrument( name = "syn2mas.mas_writer.new" , skip_all) ]
394
394
pub async fn new (
395
395
mut conn : LockedMasDatabase ,
396
396
mut writer_connections : Vec < PgConnection > ,
You can’t perform that action at this time.
0 commit comments