sstables stats: flat mutation reads

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2018-09-30 14:13:45 +03:00
parent 4ccdc1115d
commit e9dffa56c8
3 changed files with 24 additions and 0 deletions

View File

@@ -493,6 +493,7 @@ public:
};
flat_mutation_reader sstable::read_rows_flat(schema_ptr schema, const io_priority_class& pc, streamed_mutation::forwarding fwd) {
get_stats().on_sstable_partition_read();
if (_version == version_types::mc) {
return make_flat_mutation_reader<sstable_mutation_reader<data_consume_rows_context_m, mp_row_consumer_m>>(
shared_from_this(), std::move(schema), pc, no_resource_tracking(), fwd, default_read_monitor());
@@ -509,6 +510,7 @@ sstables::sstable::read_row_flat(schema_ptr schema,
streamed_mutation::forwarding fwd,
read_monitor& mon)
{
get_stats().on_single_partition_read();
if (_version == version_types::mc) {
return make_flat_mutation_reader<sstable_mutation_reader<data_consume_rows_context_m, mp_row_consumer_m>>(
shared_from_this(), std::move(schema), std::move(key), slice, pc, std::move(resource_tracker), fwd, mutation_reader::forwarding::no, mon);
@@ -525,6 +527,7 @@ sstable::read_range_rows_flat(schema_ptr schema,
streamed_mutation::forwarding fwd,
mutation_reader::forwarding fwd_mr,
read_monitor& mon) {
get_stats().on_range_partition_read();
if (_version == version_types::mc) {
return make_flat_mutation_reader<sstable_mutation_reader<data_consume_rows_context_m, mp_row_consumer_m>>(
shared_from_this(), std::move(schema), range, slice, pc, std::move(resource_tracker), fwd, fwd_mr, mon);

View File

@@ -4292,6 +4292,12 @@ future<> init_metrics() {
sm::description("Number of range tombstones written")),
sm::make_derive("cell_tombstone_writes", [] { return sstables_stats::get_shard_stats().cell_tombstone_writes; },
sm::description("Number of cell tombstones written")),
sm::make_derive("single_partition_reads", [] { return sstables_stats::get_shard_stats().single_partition_reads; },
sm::description("Number of single partition flat mutation reads")),
sm::make_derive("range_partition_reads", [] { return sstables_stats::get_shard_stats().range_partition_reads; },
sm::description("Number of partition range flat mutation reads")),
sm::make_derive("sstable_partition_reads", [] { return sstables_stats::get_shard_stats().sstable_partition_reads; },
sm::description("Number of whole sstable flat mutation reads")),
});
});
}

View File

@@ -32,6 +32,9 @@ class sstables_stats {
uint64_t range_tombstone_writes = 0;
uint64_t cell_writes = 0;
uint64_t cell_tombstone_writes = 0;
uint64_t single_partition_reads = 0;
uint64_t range_partition_reads = 0;
uint64_t sstable_partition_reads = 0;
} _shard_stats;
stats& _stats = _shard_stats;
@@ -68,6 +71,18 @@ public:
inline void on_cell_tombstone_write() {
++_stats.cell_tombstone_writes;
}
inline void on_single_partition_read() {
++_stats.single_partition_reads;
}
inline void on_range_partition_read() {
++_stats.range_partition_reads;
}
inline void on_sstable_partition_read() {
++_stats.sstable_partition_reads;
}
};
}