aboutsummaryrefslogtreecommitdiff
path: root/src/table/metrics.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-06 16:37:44 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-06 16:37:44 +0200
commitc3c8d59c996061a2a4280820915a6dcd94cf496c (patch)
tree218100fda6320495466a150580ecaf6e469fbb8e /src/table/metrics.rs
parentbbf68aa039678d844e7d88db1a23a128f877ba43 (diff)
downloadgarage-c3c8d59c996061a2a4280820915a6dcd94cf496c.tar.gz
garage-c3c8d59c996061a2a4280820915a6dcd94cf496c.zip
Fix more .unwrap()'s
Diffstat (limited to 'src/table/metrics.rs')
-rw-r--r--src/table/metrics.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/table/metrics.rs b/src/table/metrics.rs
index 3318de88..13baf4c6 100644
--- a/src/table/metrics.rs
+++ b/src/table/metrics.rs
@@ -26,10 +26,12 @@ impl TableMetrics {
.u64_value_observer(
"table.merkle_updater_todo_queue_length",
move |observer| {
- observer.observe(
- merkle_todo.len().unwrap() as u64, // TODO fix unwrap
- &[KeyValue::new("table_name", table_name)],
- )
+ if let Ok(v) = merkle_todo.len() {
+ observer.observe(
+ v as u64,
+ &[KeyValue::new("table_name", table_name)],
+ );
+ }
},
)
.with_description("Merkle tree updater TODO queue length")
@@ -38,10 +40,12 @@ impl TableMetrics {
.u64_value_observer(
"table.gc_todo_queue_length",
move |observer| {
- observer.observe(
- gc_todo.len().unwrap() as u64, // TODO fix unwrap
- &[KeyValue::new("table_name", table_name)],
- )
+ if let Ok(v) = gc_todo.len() {
+ observer.observe(
+ v as u64,
+ &[KeyValue::new("table_name", table_name)],
+ );
+ }
},
)
.with_description("Table garbage collector TODO queue length")