@@ -6,8 +6,8 @@ use serde::{Deserialize, Serialize};
66use weaver_semconv:: group:: SpanKindSpec ;
77
88use crate :: {
9- live_checker:: LiveChecker , sample_attribute:: SampleAttribute , LiveCheckResult , LiveCheckRunner ,
10- LiveCheckStatistics , SampleRef ,
9+ live_checker:: LiveChecker , sample_attribute:: SampleAttribute , Error , LiveCheckResult ,
10+ LiveCheckRunner , LiveCheckStatistics , SampleRef ,
1111} ;
1212
1313/// Represents a sample telemetry span parsed from any source
@@ -31,25 +31,29 @@ pub struct SampleSpan {
3131}
3232
3333impl LiveCheckRunner for SampleSpan {
34- fn run_live_check ( & mut self , live_checker : & mut LiveChecker , stats : & mut LiveCheckStatistics ) {
34+ fn run_live_check (
35+ & mut self ,
36+ live_checker : & mut LiveChecker ,
37+ stats : & mut LiveCheckStatistics ,
38+ ) -> Result < ( ) , Error > {
3539 let mut result = LiveCheckResult :: new ( ) ;
3640 for advisor in live_checker. advisors . iter_mut ( ) {
37- if let Ok ( advice_list) = advisor. advise ( SampleRef :: Span ( self ) , None , None ) {
38- result. add_advice_list ( advice_list) ;
39- }
41+ let advice_list = advisor. advise ( SampleRef :: Span ( self ) , None , None ) ?;
42+ result. add_advice_list ( advice_list) ;
4043 }
4144 for attribute in & mut self . attributes {
42- attribute. run_live_check ( live_checker, stats) ;
45+ attribute. run_live_check ( live_checker, stats) ? ;
4346 }
4447 for span_event in & mut self . span_events {
45- span_event. run_live_check ( live_checker, stats) ;
48+ span_event. run_live_check ( live_checker, stats) ? ;
4649 }
4750 for span_link in & mut self . span_links {
48- span_link. run_live_check ( live_checker, stats) ;
51+ span_link. run_live_check ( live_checker, stats) ? ;
4952 }
5053 self . live_check_result = Some ( result) ;
5154 stats. inc_entity_count ( "span" ) ;
5255 stats. maybe_add_live_check_result ( self . live_check_result . as_ref ( ) ) ;
56+ Ok ( ( ) )
5357 }
5458}
5559
@@ -66,19 +70,23 @@ pub struct SampleSpanEvent {
6670}
6771
6872impl LiveCheckRunner for SampleSpanEvent {
69- fn run_live_check ( & mut self , live_checker : & mut LiveChecker , stats : & mut LiveCheckStatistics ) {
73+ fn run_live_check (
74+ & mut self ,
75+ live_checker : & mut LiveChecker ,
76+ stats : & mut LiveCheckStatistics ,
77+ ) -> Result < ( ) , Error > {
7078 let mut result = LiveCheckResult :: new ( ) ;
7179 for advisor in live_checker. advisors . iter_mut ( ) {
72- if let Ok ( advice_list) = advisor. advise ( SampleRef :: SpanEvent ( self ) , None , None ) {
73- result. add_advice_list ( advice_list) ;
74- }
80+ let advice_list = advisor. advise ( SampleRef :: SpanEvent ( self ) , None , None ) ?;
81+ result. add_advice_list ( advice_list) ;
7582 }
7683 for attribute in & mut self . attributes {
77- attribute. run_live_check ( live_checker, stats) ;
84+ attribute. run_live_check ( live_checker, stats) ? ;
7885 }
7986 self . live_check_result = Some ( result) ;
8087 stats. inc_entity_count ( "span_event" ) ;
8188 stats. maybe_add_live_check_result ( self . live_check_result . as_ref ( ) ) ;
89+ Ok ( ( ) )
8290 }
8391}
8492
@@ -93,18 +101,22 @@ pub struct SampleSpanLink {
93101}
94102
95103impl LiveCheckRunner for SampleSpanLink {
96- fn run_live_check ( & mut self , live_checker : & mut LiveChecker , stats : & mut LiveCheckStatistics ) {
104+ fn run_live_check (
105+ & mut self ,
106+ live_checker : & mut LiveChecker ,
107+ stats : & mut LiveCheckStatistics ,
108+ ) -> Result < ( ) , Error > {
97109 let mut result = LiveCheckResult :: new ( ) ;
98110 for advisor in live_checker. advisors . iter_mut ( ) {
99- if let Ok ( advice_list) = advisor. advise ( SampleRef :: SpanLink ( self ) , None , None ) {
100- result. add_advice_list ( advice_list) ;
101- }
111+ let advice_list = advisor. advise ( SampleRef :: SpanLink ( self ) , None , None ) ?;
112+ result. add_advice_list ( advice_list) ;
102113 }
103114 for attribute in & mut self . attributes {
104- attribute. run_live_check ( live_checker, stats) ;
115+ attribute. run_live_check ( live_checker, stats) ? ;
105116 }
106117 self . live_check_result = Some ( result) ;
107118 stats. inc_entity_count ( "span_link" ) ;
108119 stats. maybe_add_live_check_result ( self . live_check_result . as_ref ( ) ) ;
120+ Ok ( ( ) )
109121 }
110122}
0 commit comments