Skip to content

Commit

Permalink
lint error, and disclaimer for hashbrown
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Mar 1, 2024
1 parent 44efee7 commit d8c56da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions opentelemetry-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ testing = ["opentelemetry/testing", "trace", "metrics", "logs", "rt-async-std",
rt-tokio = ["tokio", "tokio-stream"]
rt-tokio-current-thread = ["tokio", "tokio-stream"]
rt-async-std = ["async-std"]
# Enable use_hashbrown for critical performance when measurement attributes are secure and not prone to external manipulation.
use_hashbrown = ["hashbrown", "ahash"]

[[bench]]
Expand Down
21 changes: 12 additions & 9 deletions opentelemetry-sdk/src/metrics/internal/sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@ impl<T: Number<T>> Sum<T> {
}
}
Err(e) => {
global::handle_error(MetricsError::Other(
format!("Failed to acquire lock on bucket due to: {:?}", e).into(),
));
global::handle_error(MetricsError::Other(format!(
"Failed to acquire lock on bucket due to: {:?}",
e
)));
}
}
}
Expand Down Expand Up @@ -410,9 +411,10 @@ impl<T: Number<T>> PrecomputedSum<T> {
}
Err(e) => {
// Log or handle the lock acquisition error if necessary
global::handle_error(MetricsError::Other(
format!("Failed to acquire lock on bucket due to: {:?}", e).into(),
));
global::handle_error(MetricsError::Other(format!(
"Failed to acquire lock on bucket due to: {:?}",
e
)));
// Continue to the next bucket if the lock cannot be acquired
continue;
}
Expand Down Expand Up @@ -488,9 +490,10 @@ impl<T: Number<T>> PrecomputedSum<T> {
Ok(bucket) => bucket,
Err(e) => {
// Log the error or handle it as needed.
global::handle_error(MetricsError::Other(
format!("Failed to acquire lock on bucket due to: {:?}", e).into(),
));
global::handle_error(MetricsError::Other(format!(
"Failed to acquire lock on bucket due to: {:?}",
e
)));
continue; // Skip to the next bucket if the lock cannot be acquired.
}
};
Expand Down

0 comments on commit d8c56da

Please sign in to comment.