File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -133,12 +133,11 @@ impl TracingInfo {
133133
134134 /// Create a mock tracing info for testing.
135135 #[ cfg( test) ]
136- pub const fn mock ( ) -> Self {
137-
136+ pub fn mock ( ) -> Self {
138137 Self {
139138 service : "test" ,
140139 context : None ,
141- span : OnceLock :: new ( ) ,
140+ span : OnceLock :: from ( info_span ! ( "" ) ) ,
142141 }
143142 }
144143}
@@ -377,6 +376,12 @@ pub struct HandlerArgs {
377376
378377impl HandlerArgs {
379378 /// Create new handler arguments.
379+ ///
380+ /// ## Panics
381+ ///
382+ /// If the ctx tracing span has not been initialized via
383+ /// [`HandlerCtx::init_request_span`].
384+ #[ track_caller]
380385 pub fn new ( ctx : HandlerCtx , req : Request ) -> Self {
381386 let this = Self {
382387 ctx,
@@ -406,6 +411,12 @@ impl HandlerArgs {
406411 }
407412
408413 /// Get a reference to the tracing span for this handler invocation.
414+ ///
415+ /// ## Panics
416+ ///
417+ /// If the span has not been initialized via
418+ /// [`HandlerCtx::init_request_span`].
419+ #[ track_caller]
409420 pub fn span ( & self ) -> & tracing:: Span {
410421 self . ctx . span ( )
411422 }
You can’t perform that action at this time.
0 commit comments