Skip to content

Commit d8c56da

Browse files
committed
lint error, and disclaimer for hashbrown
1 parent 44efee7 commit d8c56da

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

opentelemetry-sdk/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ testing = ["opentelemetry/testing", "trace", "metrics", "logs", "rt-async-std",
5656
rt-tokio = ["tokio", "tokio-stream"]
5757
rt-tokio-current-thread = ["tokio", "tokio-stream"]
5858
rt-async-std = ["async-std"]
59+
# Enable use_hashbrown for critical performance when measurement attributes are secure and not prone to external manipulation.
5960
use_hashbrown = ["hashbrown", "ahash"]
6061

6162
[[bench]]

opentelemetry-sdk/src/metrics/internal/sum.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,10 @@ impl<T: Number<T>> Sum<T> {
219219
}
220220
}
221221
Err(e) => {
222-
global::handle_error(MetricsError::Other(
223-
format!("Failed to acquire lock on bucket due to: {:?}", e).into(),
224-
));
222+
global::handle_error(MetricsError::Other(format!(
223+
"Failed to acquire lock on bucket due to: {:?}",
224+
e
225+
)));
225226
}
226227
}
227228
}
@@ -410,9 +411,10 @@ impl<T: Number<T>> PrecomputedSum<T> {
410411
}
411412
Err(e) => {
412413
// Log or handle the lock acquisition error if necessary
413-
global::handle_error(MetricsError::Other(
414-
format!("Failed to acquire lock on bucket due to: {:?}", e).into(),
415-
));
414+
global::handle_error(MetricsError::Other(format!(
415+
"Failed to acquire lock on bucket due to: {:?}",
416+
e
417+
)));
416418
// Continue to the next bucket if the lock cannot be acquired
417419
continue;
418420
}
@@ -488,9 +490,10 @@ impl<T: Number<T>> PrecomputedSum<T> {
488490
Ok(bucket) => bucket,
489491
Err(e) => {
490492
// Log the error or handle it as needed.
491-
global::handle_error(MetricsError::Other(
492-
format!("Failed to acquire lock on bucket due to: {:?}", e).into(),
493-
));
493+
global::handle_error(MetricsError::Other(format!(
494+
"Failed to acquire lock on bucket due to: {:?}",
495+
e
496+
)));
494497
continue; // Skip to the next bucket if the lock cannot be acquired.
495498
}
496499
};

0 commit comments

Comments
 (0)