Skip to content

Commit ed4d379

Browse files
authored
Global error handler cleanup - Metrics View (#2249)
1 parent 1a73d52 commit ed4d379

File tree

1 file changed

+5
-16
lines changed
  • opentelemetry-sdk/src/metrics

1 file changed

+5
-16
lines changed

opentelemetry-sdk/src/metrics/view.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use super::instrument::{Instrument, Stream};
22
use glob::Pattern;
3-
use opentelemetry::{
4-
global,
5-
metrics::{MetricError, MetricResult},
6-
};
3+
use opentelemetry::metrics::{MetricError, MetricResult};
74

85
fn empty_view(_inst: &Instrument) -> Option<Stream> {
96
None
@@ -102,19 +99,14 @@ impl View for Box<dyn View> {
10299
/// ```
103100
pub 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

Comments
 (0)