11use super :: instrument:: { Instrument , Stream } ;
22use glob:: Pattern ;
3- use opentelemetry:: {
4- global,
5- metrics:: { MetricError , MetricResult } ,
6- } ;
3+ use opentelemetry:: metrics:: { MetricError , MetricResult } ;
74
85fn empty_view ( _inst : & Instrument ) -> Option < Stream > {
96 None
@@ -102,19 +99,14 @@ impl View for Box<dyn View> {
10299/// ```
103100pub fn new_view ( criteria : Instrument , mask : Stream ) -> MetricResult < Box < dyn View > > {
104101 if criteria. is_empty ( ) {
105- global:: handle_error ( MetricError :: Config ( format ! (
106- "no criteria provided, dropping view. mask: {mask:?}"
107- ) ) ) ;
102+ // TODO - The error is getting lost here. Need to return or log.
108103 return Ok ( Box :: new ( empty_view) ) ;
109104 }
110105 let contains_wildcard = criteria. name . contains ( [ '*' , '?' ] ) ;
111- let err_msg_criteria = criteria. clone ( ) ;
112106
113107 let match_fn: Box < dyn Fn ( & Instrument ) -> bool + Send + Sync > = if contains_wildcard {
114108 if mask. name != "" {
115- global:: handle_error ( MetricError :: Config ( format ! (
116- "name replacement for multiple instruments, dropping view, criteria: {criteria:?}, mask: {mask:?}"
117- ) ) ) ;
109+ // TODO - The error is getting lost here. Need to return or log.
118110 return Ok ( Box :: new ( empty_view) ) ;
119111 }
120112
@@ -137,11 +129,8 @@ pub fn new_view(criteria: Instrument, mask: Stream) -> MetricResult<Box<dyn View
137129 if let Some ( ma) = & mask. aggregation {
138130 match ma. validate ( ) {
139131 Ok ( _) => agg = Some ( ma. clone ( ) ) ,
140- Err ( err) => {
141- global:: handle_error ( MetricError :: Other ( format ! (
142- "{}, proceeding as if view did not exist. criteria: {:?}, mask: {:?}" ,
143- err, err_msg_criteria, mask
144- ) ) ) ;
132+ Err ( _) => {
133+ // TODO - The error is getting lost here. Need to return or log.
145134 return Ok ( Box :: new ( empty_view) ) ;
146135 }
147136 }
0 commit comments