aboutsummaryrefslogtreecommitdiff
path: root/src/table/metrics.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-03-08 14:59:56 +0100
committerAlex Auvolat <alex@adnab.me>2024-03-08 15:09:57 +0100
commit05c92204ecab87540806073ac4deedfd58519240 (patch)
tree56e82bc1085e956ea0b2b622c7967d0991113c87 /src/table/metrics.rs
parent44454aac012cbef9158110f2352301ffcfaf31c7 (diff)
downloadgarage-05c92204ecab87540806073ac4deedfd58519240.tar.gz
garage-05c92204ecab87540806073ac4deedfd58519240.zip
[rm-sled] Remove counted_tree_hack
Diffstat (limited to 'src/table/metrics.rs')
-rw-r--r--src/table/metrics.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/table/metrics.rs b/src/table/metrics.rs
index 8318a84f..7bb0959a 100644
--- a/src/table/metrics.rs
+++ b/src/table/metrics.rs
@@ -1,7 +1,6 @@
use opentelemetry::{global, metrics::*, KeyValue};
use garage_db as db;
-use garage_db::counted_tree_hack::CountedTree;
/// TableMetrics reference all counter used for metrics
pub struct TableMetrics {
@@ -27,7 +26,7 @@ impl TableMetrics {
store: db::Tree,
merkle_tree: db::Tree,
merkle_todo: db::Tree,
- gc_todo: CountedTree,
+ gc_todo: db::Tree,
) -> Self {
let meter = global::meter(table_name);
TableMetrics {
@@ -35,9 +34,9 @@ impl TableMetrics {
.u64_value_observer(
"table.size",
move |observer| {
- if let Ok(Some(v)) = store.fast_len() {
+ if let Ok(value) = store.len() {
observer.observe(
- v as u64,
+ value as u64,
&[KeyValue::new("table_name", table_name)],
);
}
@@ -49,9 +48,9 @@ impl TableMetrics {
.u64_value_observer(
"table.merkle_tree_size",
move |observer| {
- if let Ok(Some(v)) = merkle_tree.fast_len() {
+ if let Ok(value) = merkle_tree.len() {
observer.observe(
- v as u64,
+ value as u64,
&[KeyValue::new("table_name", table_name)],
);
}
@@ -77,10 +76,12 @@ impl TableMetrics {
.u64_value_observer(
"table.gc_todo_queue_length",
move |observer| {
- observer.observe(
- gc_todo.len() as u64,
- &[KeyValue::new("table_name", table_name)],
- );
+ if let Ok(value) = gc_todo.len() {
+ observer.observe(
+ value as u64,
+ &[KeyValue::new("table_name", table_name)],
+ );
+ }
},
)
.with_description("Table garbage collector TODO queue length")