Adding the read latency support to the storage proxy

This adds the latency histogram support to the storage_proxy.

It uses a the latency object to mark the opetation latency, if there
will be an impact on performance, it can be changed from all operations
to sample of the operation.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
Amnon Heiman
2015-08-03 16:56:16 +03:00
parent 0ca7189664
commit c0a52a28bc

View File

@@ -2085,11 +2085,15 @@ storage_proxy::do_query(schema_ptr s,
if (partition_ranges.empty()) {
return make_empty();
}
utils::latency_counter lc;
lc.start();
if (partition_ranges[0].is_singular() && partition_ranges[0].start()->value().has_key()) { // do not support mixed partitions (yet?)
try {
return query_singular(cmd, std::move(partition_ranges), cl);
return query_singular(cmd, std::move(partition_ranges), cl).finally([lc, this] () mutable {
_stats.read.mark(lc.stop().latency_in_nano());
});
} catch (const no_such_column_family&) {
_stats.read.mark(lc.stop().latency_in_nano());
return make_empty();
}
}
@@ -2097,9 +2101,12 @@ storage_proxy::do_query(schema_ptr s,
if (partition_ranges.size() != 1) {
// FIXME: implement
throw std::runtime_error("more than one non singular range not supported yet");
_stats.read.mark(lc.stop().latency_in_nano());
}
return query_partition_key_range(cmd, std::move(partition_ranges[0]), cl);
return query_partition_key_range(cmd, std::move(partition_ranges[0]), cl).finally([lc, this] () mutable {
_stats.read.mark(lc.stop().latency_in_nano());
});
}
#if 0