Add tracing to GlobalTagThrottler

This commit is contained in:
sfc-gh-tclinkenbeard 2022-07-13 20:47:58 -07:00
parent fe05cc5c72
commit afba51b7f8
2 changed files with 14 additions and 0 deletions

View File

@ -179,6 +179,11 @@ class GlobalTagThrottlerImpl {
for (const auto& [id, _] : throughput) {
result += getCurrentCost(id, tag, opType).orDefault(0);
}
TraceEvent("GlobalTagThrottler_GetCurrentCost")
.detail("Tag", printable(tag))
.detail("Op", (opType == OpType::READ) ? "Read" : "Write")
.detail("Cost", result);
return result;
}
@ -210,6 +215,11 @@ class GlobalTagThrottlerImpl {
return 1.0;
}
auto const transactionRate = stats.get().getTransactionRate();
TraceEvent("GlobalTagThrottler_GetAverageTransactionCost")
.detail("Tag", tag)
.detail("OpType", (opType == OpType::READ) ? "Read" : "Write")
.detail("TransactionRate", transactionRate)
.detail("Cost", cost);
if (transactionRate == 0.0) {
return 1.0;
} else {

View File

@ -690,6 +690,10 @@ struct ReadWriteWorkload : ReadWriteCommon {
break;
} catch (Error& e) {
if (e.code() == error_code_tag_throttled) {
++self->transactionsTagThrottled;
}
self->transactionFailureMetric->errorCode = e.code();
self->transactionFailureMetric->log();