add stats for storage provider reads

Former-commit-id: 612393ffba43cda31443605de924dc8dcf77ef52
This commit is contained in:
malavan 2021-08-26 19:45:33 +00:00
parent dd9e0ab9c3
commit 89e6442c09
3 changed files with 10 additions and 2 deletions

View File

@ -2801,8 +2801,10 @@ LNotFound:
serverAssert(m_setexpire->find(sdsKey) != m_setexpire->end()); serverAssert(m_setexpire->find(sdsKey) != m_setexpire->end());
} }
serverAssert(o->FExpires() == (m_setexpire->find(sdsKey) != m_setexpire->end())); serverAssert(o->FExpires() == (m_setexpire->find(sdsKey) != m_setexpire->end()));
g_pserver->stat_storage_provider_read_hits++;
} else { } else {
sdsfree(sdsNewKey); sdsfree(sdsNewKey);
g_pserver->stat_storage_provider_read_misses++;
} }
*pde = dictFind(m_pdict, sdsKey); *pde = dictFind(m_pdict, sdsKey);

View File

@ -5798,7 +5798,9 @@ sds genRedisInfoString(const char *section) {
"total_reads_processed:%lld\r\n" "total_reads_processed:%lld\r\n"
"total_writes_processed:%lld\r\n" "total_writes_processed:%lld\r\n"
"instantaneous_lock_contention:%d\r\n" "instantaneous_lock_contention:%d\r\n"
"avg_lock_contention:%f\r\n", "avg_lock_contention:%f\r\n"
"storage_provider_read_hits:%lld\r\n"
"storage_provider_read_misses:%lld\r\n",
g_pserver->stat_numconnections, g_pserver->stat_numconnections,
g_pserver->stat_numcommands, g_pserver->stat_numcommands,
getInstantaneousMetric(STATS_METRIC_COMMAND), getInstantaneousMetric(STATS_METRIC_COMMAND),
@ -5836,7 +5838,9 @@ sds genRedisInfoString(const char *section) {
stat_total_reads_processed, stat_total_reads_processed,
stat_total_writes_processed, stat_total_writes_processed,
aeLockContention(), aeLockContention(),
avgLockContention); avgLockContention,
g_pserver->stat_storage_provider_read_hits,
g_pserver->stat_storage_provider_read_misses);
} }
/* Replication */ /* Replication */

View File

@ -2242,6 +2242,8 @@ struct redisServer {
long long stat_dump_payload_sanitizations; /* Number deep dump payloads integrity validations. */ long long stat_dump_payload_sanitizations; /* Number deep dump payloads integrity validations. */
std::atomic<long long> stat_total_reads_processed; /* Total number of read events processed */ std::atomic<long long> stat_total_reads_processed; /* Total number of read events processed */
std::atomic<long long> stat_total_writes_processed; /* Total number of write events processed */ std::atomic<long long> stat_total_writes_processed; /* Total number of write events processed */
long long stat_storage_provider_read_hits;
long long stat_storage_provider_read_misses;
/* The following two are used to track instantaneous metrics, like /* The following two are used to track instantaneous metrics, like
* number of operations per second, network traffic. */ * number of operations per second, network traffic. */
struct { struct {