@@ -3,7 +3,7 @@ use indexmap::IndexMap;
33use serde:: { Deserialize , Serialize } ;
44use snafu:: { ResultExt , Snafu } ;
55use tokio:: task:: JoinError ;
6- use tracing:: { info, instrument} ;
6+ use tracing:: { info, instrument, Instrument , Span } ;
77
88#[ cfg( feature = "openapi" ) ]
99use utoipa:: ToSchema ;
@@ -50,7 +50,11 @@ pub struct ReleaseSpec {
5050
5151impl ReleaseSpec {
5252 /// Installs a release by installing individual operators.
53- #[ instrument( skip_all) ]
53+ #[ instrument( skip_all, fields(
54+ %namespace,
55+ product. included = tracing:: field:: Empty ,
56+ product. excluded = tracing:: field:: Empty ,
57+ ) ) ]
5458 pub async fn install (
5559 & self ,
5660 include_products : & [ String ] ,
@@ -60,29 +64,44 @@ impl ReleaseSpec {
6064 ) -> Result < ( ) > {
6165 info ! ( "Installing release" ) ;
6266
67+ include_products. iter ( ) . for_each ( |product| {
68+ Span :: current ( ) . record ( "product.included" , product) ;
69+ } ) ;
70+ exclude_products. iter ( ) . for_each ( |product| {
71+ Span :: current ( ) . record ( "product.excluded" , product) ;
72+ } ) ;
73+
6374 let namespace = namespace. to_string ( ) ;
6475 futures:: stream:: iter ( self . filter_products ( include_products, exclude_products) )
6576 . map ( |( product_name, product) | {
77+ let task_span =
78+ tracing:: debug_span!( "install_operator" , product_name = tracing:: field:: Empty ) ;
79+
6680 let namespace = namespace. clone ( ) ;
6781 let chart_source = chart_source. clone ( ) ;
6882 // Helm installs currently `block_in_place`, so we need to spawn each job onto a separate task to
6983 // get useful parallelism.
70- tokio:: spawn ( async move {
71- info ! ( "Installing {product_name}-operator" ) ;
72-
73- // Create operator spec
74- let operator = OperatorSpec :: new ( & product_name, Some ( product. version . clone ( ) ) )
75- . context ( OperatorSpecParseSnafu ) ?;
76-
77- // Install operator
78- operator
79- . install ( & namespace, & chart_source)
80- . context ( HelmInstallSnafu ) ?;
81-
82- info ! ( "Installed {product_name}-operator" ) ;
83-
84- Ok ( ( ) )
85- } )
84+ tokio:: spawn (
85+ async move {
86+ Span :: current ( ) . record ( "product_name" , & product_name) ;
87+ info ! ( "Installing {product_name}-operator" ) ;
88+
89+ // Create operator spec
90+ let operator =
91+ OperatorSpec :: new ( & product_name, Some ( product. version . clone ( ) ) )
92+ . context ( OperatorSpecParseSnafu ) ?;
93+
94+ // Install operator
95+ operator
96+ . install ( & namespace, & chart_source)
97+ . context ( HelmInstallSnafu ) ?;
98+
99+ info ! ( "Installed {product_name}-operator" ) ;
100+
101+ Ok ( ( ) )
102+ }
103+ . instrument ( task_span) ,
104+ )
86105 } )
87106 . buffer_unordered ( 10 )
88107 . map ( |res| res. context ( BackgroundTaskSnafu ) ?)
0 commit comments