Add getMappedRange latency metrics
This commit is contained in:
parent
bc62b538b1
commit
72e72f6d87
|
@ -948,6 +948,9 @@ public:
|
|||
|
||||
LatencySample readLatencySample;
|
||||
LatencyBands readLatencyBands;
|
||||
LatencySample mappedRangeSample; // Samples getMappedRange latency
|
||||
LatencySample mappedRangeRemoteSample; // Samples getMappedRange remote subquery latency
|
||||
LatencySample mappedRangeLocalSample; // Samples getMappedRange local subquery latency
|
||||
|
||||
Counters(StorageServer* self)
|
||||
: cc("StorageServer", self->thisServerID.toString()), allQueries("QueryQueue", cc),
|
||||
|
@ -979,7 +982,19 @@ public:
|
|||
self->thisServerID,
|
||||
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
|
||||
SERVER_KNOBS->LATENCY_SAMPLE_SIZE),
|
||||
readLatencyBands("ReadLatencyBands", self->thisServerID, SERVER_KNOBS->STORAGE_LOGGING_DELAY) {
|
||||
readLatencyBands("ReadLatencyBands", self->thisServerID, SERVER_KNOBS->STORAGE_LOGGING_DELAY),
|
||||
mappedRangeSample("GetMappedRangeMetrics",
|
||||
self->thisServerID,
|
||||
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
|
||||
SERVER_KNOBS->LATENCY_SAMPLE_SIZE),
|
||||
mappedRangeRemoteSample("GetMappedRangeRemoteMetrics",
|
||||
self->thisServerID,
|
||||
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
|
||||
SERVER_KNOBS->LATENCY_SAMPLE_SIZE),
|
||||
mappedRangeLocalSample("GetMappedRangeLocalMetrics",
|
||||
self->thisServerID,
|
||||
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
|
||||
SERVER_KNOBS->LATENCY_SAMPLE_SIZE) {
|
||||
specialCounter(cc, "LastTLogVersion", [self]() { return self->lastTLogVersion; });
|
||||
specialCounter(cc, "Version", [self]() { return self->version.get(); });
|
||||
specialCounter(cc, "StorageVersion", [self]() { return self->storageVersion(); });
|
||||
|
@ -2944,6 +2959,7 @@ ACTOR Future<GetValueReqAndResultRef> quickGetValue(StorageServer* data,
|
|||
// To provide span context, tags, debug ID to underlying lookups.
|
||||
GetMappedKeyValuesRequest* pOriginalReq) {
|
||||
state GetValueReqAndResultRef getValue;
|
||||
state double getValueStart = g_network->timer();
|
||||
getValue.key = key;
|
||||
|
||||
if (data->shards[key]->isReadable()) {
|
||||
|
@ -2964,6 +2980,8 @@ ACTOR Future<GetValueReqAndResultRef> quickGetValue(StorageServer* data,
|
|||
if (!reply.error.present()) {
|
||||
++data->counters.quickGetValueHit;
|
||||
copyOptionalValue(a, getValue, reply.value);
|
||||
const double duration = g_network->timer() - getValueStart;
|
||||
data->counters.mappedRangeLocalSample.addMeasurement(duration);
|
||||
return getValue;
|
||||
}
|
||||
// Otherwise fallback.
|
||||
|
@ -2983,6 +3001,8 @@ ACTOR Future<GetValueReqAndResultRef> quickGetValue(StorageServer* data,
|
|||
// TODO: async in case it needs to read from other servers.
|
||||
Optional<Value> valueOption = wait(valueFuture);
|
||||
copyOptionalValue(a, getValue, valueOption);
|
||||
double duration = g_network->timer() - getValueStart;
|
||||
data->counters.mappedRangeRemoteSample.addMeasurement(duration);
|
||||
return getValue;
|
||||
} else {
|
||||
throw quick_get_value_miss();
|
||||
|
@ -3548,6 +3568,7 @@ ACTOR Future<GetRangeReqAndResultRef> quickGetKeyValues(
|
|||
// To provide span context, tags, debug ID to underlying lookups.
|
||||
GetMappedKeyValuesRequest* pOriginalReq) {
|
||||
state GetRangeReqAndResultRef getRange;
|
||||
state double getValuesStart = g_network->timer();
|
||||
getRange.begin = firstGreaterOrEqual(KeyRef(*a, prefix));
|
||||
getRange.end = firstGreaterOrEqual(strinc(prefix, *a));
|
||||
try {
|
||||
|
@ -3578,6 +3599,8 @@ ACTOR Future<GetRangeReqAndResultRef> quickGetKeyValues(
|
|||
// Convert GetKeyValuesReply to RangeResult.
|
||||
a->dependsOn(reply.arena);
|
||||
getRange.result = RangeResultRef(reply.data, reply.more);
|
||||
const double duration = g_network->timer() - getValuesStart;
|
||||
data->counters.mappedRangeLocalSample.addMeasurement(duration);
|
||||
return getRange;
|
||||
}
|
||||
// Otherwise fallback.
|
||||
|
@ -3597,6 +3620,8 @@ ACTOR Future<GetRangeReqAndResultRef> quickGetKeyValues(
|
|||
RangeResult rangeResult = wait(rangeResultFuture);
|
||||
a->dependsOn(rangeResult.arena());
|
||||
getRange.result = rangeResult;
|
||||
const double duration = g_network->timer() - getValuesStart;
|
||||
data->counters.mappedRangeRemoteSample.addMeasurement(duration);
|
||||
return getRange;
|
||||
} else {
|
||||
throw quick_get_key_values_miss();
|
||||
|
@ -4262,6 +4287,7 @@ ACTOR Future<Void> getMappedKeyValuesQ(StorageServer* data, GetMappedKeyValuesRe
|
|||
|
||||
double duration = g_network->timer() - req.requestTime();
|
||||
data->counters.readLatencySample.addMeasurement(duration);
|
||||
data->counters.mappedRangeSample.addMeasurement(duration);
|
||||
if (data->latencyBandConfig.present()) {
|
||||
int maxReadBytes =
|
||||
data->latencyBandConfig.get().readConfig.maxReadBytes.orDefault(std::numeric_limits<int>::max());
|
||||
|
|
Loading…
Reference in New Issue