db, view: add view update generator metrics

The view update generator completely lacked metrics, so a basic set
of them is now exposed.
This commit is contained in:
Piotr Sarna
2020-08-11 10:50:59 +02:00
parent 180a1505fd
commit e4d78b60ff
2 changed files with 22 additions and 1 deletions

View File

@@ -152,4 +152,21 @@ future<> view_update_generator::register_staging_sstable(sstables::shared_sstabl
}
}
void view_update_generator::setup_metrics() {
namespace sm = seastar::metrics;
_metrics.add_group("view_update_generator", {
sm::make_gauge("pending_registrations", sm::description("Number of tasks waiting to register staging sstables"),
[this] { return _registration_sem.waiters(); }),
sm::make_gauge("queued_batches_count",
sm::description("Number of sets of sstables queued for view update generation"),
[this] { return _sstables_with_tables.size(); }),
sm::make_gauge("sstables_to_move_count",
sm::description("Number of sets of sstables which are already processed and wait to be moved from their staging directory"),
[this] { return _sstables_to_move.size(); })
});
}
}

View File

@@ -48,8 +48,11 @@ private:
};
std::unordered_map<lw_shared_ptr<table>, std::vector<sstables::shared_sstable>> _sstables_with_tables;
std::unordered_map<lw_shared_ptr<table>, std::vector<sstables::shared_sstable>> _sstables_to_move;
metrics::metric_groups _metrics;
public:
view_update_generator(database& db) : _db(db) { }
view_update_generator(database& db) : _db(db) {
setup_metrics();
}
future<> start();
future<> stop();
@@ -58,6 +61,7 @@ public:
ssize_t available_register_units() const { return _registration_sem.available_units(); }
private:
bool should_throttle() const;
void setup_metrics();
};
}