@@ -15,6 +15,7 @@ use azure_core::{
1515 ClientMethodOptions , ClientOptions , Context , Method , Pipeline , Request , RequestContent , Result ,
1616 Url ,
1717} ;
18+ use tracing:: Span ;
1819
1920/// The test-proxy client.
2021///
@@ -45,6 +46,7 @@ impl Client {
4546 & self . endpoint
4647 }
4748
49+ #[ tracing:: instrument( level = "trace" , skip_all, fields( endpoint = %self . endpoint) , err) ]
4850 pub async fn record_start (
4951 & self ,
5052 body : RequestContent < StartPayload > ,
@@ -66,6 +68,7 @@ impl Client {
6668 Ok ( RecordStartResult { recording_id } )
6769 }
6870
71+ #[ tracing:: instrument( level = "trace" , skip_all, fields( endpoint = %self . endpoint, recording_id) , err) ]
6972 pub async fn record_stop (
7073 & self ,
7174 recording_id : & str ,
@@ -85,12 +88,17 @@ impl Client {
8588 Ok ( ( ) )
8689 }
8790
91+ #[ tracing:: instrument( level = "trace" , skip_all, fields( endpoint = %self . endpoint, recording_id) , err) ]
8892 pub async fn playback_start (
8993 & self ,
9094 body : RequestContent < StartPayload > ,
9195 options : Option < ClientPlaybackStartOptions < ' _ > > ,
9296 ) -> Result < PlaybackStartResult > {
9397 let options = options. unwrap_or_default ( ) ;
98+ Span :: current ( ) . record (
99+ stringify ! ( recording_id) ,
100+ options. recording_id . map ( AsRef :: as_ref) ,
101+ ) ;
94102 let ctx = Context :: with_context ( & options. method_options . context ) ;
95103 let mut url = self . endpoint . clone ( ) ;
96104 url = url. join ( "/Playback/Start" ) ?;
@@ -109,6 +117,7 @@ impl Client {
109117 Ok ( result)
110118 }
111119
120+ #[ tracing:: instrument( level = "trace" , skip_all, fields( endpoint = %self . endpoint, recording_id) , err) ]
112121 pub async fn playback_stop (
113122 & self ,
114123 recording_id : & str ,
@@ -126,12 +135,17 @@ impl Client {
126135 Ok ( ( ) )
127136 }
128137
138+ #[ tracing:: instrument( level = "trace" , skip_all, fields( endpoint = %self . endpoint, recording_id) , err) ]
129139 pub async fn set_matcher (
130140 & self ,
131141 matcher : Matcher ,
132142 options : Option < ClientSetMatcherOptions < ' _ > > ,
133143 ) -> Result < ( ) > {
134144 let options = options. unwrap_or_default ( ) ;
145+ Span :: current ( ) . record (
146+ stringify ! ( recording_id) ,
147+ options. recording_id . map ( AsRef :: as_ref) ,
148+ ) ;
135149 let ctx = Context :: with_context ( & options. method_options . context ) ;
136150 let mut url = self . endpoint . clone ( ) ;
137151 url = url. join ( "/Admin/SetMatcher" ) ?;
@@ -144,6 +158,7 @@ impl Client {
144158 Ok ( ( ) )
145159 }
146160
161+ #[ tracing:: instrument( level = "trace" , skip_all, fields( endpoint = %self . endpoint, recording_id) , err) ]
147162 pub async fn add_sanitizer < S > (
148163 & self ,
149164 sanitizer : S ,
@@ -154,6 +169,10 @@ impl Client {
154169 azure_core:: Error : From < <S as AsHeaders >:: Error > ,
155170 {
156171 let options = options. unwrap_or_default ( ) ;
172+ Span :: current ( ) . record (
173+ stringify ! ( recording_id) ,
174+ options. recording_id . map ( AsRef :: as_ref) ,
175+ ) ;
157176 let ctx = Context :: with_context ( & options. method_options . context ) ;
158177 let mut url = self . endpoint . clone ( ) ;
159178 url = url. join ( "/Admin/AddSanitizer" ) ?;
@@ -166,12 +185,17 @@ impl Client {
166185 Ok ( ( ) )
167186 }
168187
188+ #[ tracing:: instrument( level = "trace" , skip_all, fields( endpoint = %self . endpoint, recording_id) , err) ]
169189 pub async fn remove_sanitizers (
170190 & self ,
171191 body : RequestContent < SanitizerList > ,
172192 options : Option < ClientRemoveSanitizersOptions < ' _ > > ,
173193 ) -> Result < RemovedSanitizers > {
174194 let options = options. unwrap_or_default ( ) ;
195+ Span :: current ( ) . record (
196+ stringify ! ( recording_id) ,
197+ options. recording_id . map ( AsRef :: as_ref) ,
198+ ) ;
175199 let ctx = Context :: with_context ( & options. method_options . context ) ;
176200 let mut url = self . endpoint . clone ( ) ;
177201 url = url. join ( "/Admin/RemoveSanitizers" ) ?;
@@ -187,8 +211,13 @@ impl Client {
187211 . await
188212 }
189213
214+ #[ tracing:: instrument( level = "trace" , skip_all, fields( endpoint = %self . endpoint, recording_id) , err) ]
190215 pub async fn reset ( & self , options : Option < ClientResetOptions < ' _ > > ) -> Result < ( ) > {
191216 let options = options. unwrap_or_default ( ) ;
217+ Span :: current ( ) . record (
218+ stringify ! ( recording_id) ,
219+ options. recording_id . map ( AsRef :: as_ref) ,
220+ ) ;
192221 let ctx = Context :: with_context ( & options. method_options . context ) ;
193222 let mut url = self . endpoint . clone ( ) ;
194223 url = url. join ( "/Admin/Reset" ) ?;
0 commit comments