From 192c1949a36d9d8313be65ada2aa8735c0779677 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Sun, 12 Aug 2018 16:35:58 +0300 Subject: [PATCH] sstables stats: partition seeks Signed-off-by: Benny Halevy --- sstables/partition.cc | 5 ++++- sstables/sstables.cc | 2 ++ sstables/stats.hh | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sstables/partition.cc b/sstables/partition.cc index 0fc9aa84c3..4c953e3f43 100644 --- a/sstables/partition.cc +++ b/sstables/partition.cc @@ -269,7 +269,9 @@ private: return make_ready_future<>(); } assert(_index_reader->element_kind() == indexable_element::partition); - return _context->skip_to(_index_reader->element_kind(), start); + return _context->skip_to(_index_reader->element_kind(), start).then([this] { + _sst->get_stats().on_partition_seek(); + }); }); } future<> read_from_index() { @@ -381,6 +383,7 @@ private: return make_ready_future<>(); } return _context->skip_to(idx.element_kind(), index_position.start).then([this, &idx] { + _sst->get_stats().on_partition_seek(); set_range_tombstone_start_from_end_open_marker(_consumer, *_schema, idx); }); }); diff --git a/sstables/sstables.cc b/sstables/sstables.cc index a59f88b87f..a1e0368f62 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -4300,6 +4300,8 @@ future<> init_metrics() { sm::description("Number of whole sstable flat mutation reads")), sm::make_derive("partition_reads", [] { return sstables_stats::get_shard_stats().partition_reads; }, sm::description("Number of partitions read")), + sm::make_derive("partition_seeks", [] { return sstables_stats::get_shard_stats().partition_seeks; }, + sm::description("Number of partitions seeked")), }); }); } diff --git a/sstables/stats.hh b/sstables/stats.hh index 03593d1a33..a9d1ba206d 100644 --- a/sstables/stats.hh +++ b/sstables/stats.hh @@ -36,6 +36,7 @@ class sstables_stats { uint64_t range_partition_reads = 0; uint64_t sstable_partition_reads = 0; uint64_t partition_reads = 0; + uint64_t partition_seeks = 0; } _shard_stats; stats& _stats = _shard_stats; @@ -88,6 +89,10 @@ public: inline void on_partition_read() { ++_stats.partition_reads; } + + inline void on_partition_seek() { + ++_stats.partition_seeks; + } }; }