diff options
| author | Dan Engelbrecht <[email protected]> | 2023-11-06 14:50:33 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-06 14:50:33 +0100 |
| commit | 0b184fd2a65852028672a7a0013ec794c7e0b071 (patch) | |
| tree | 8f2d6f8296016943c1544716a6110be58729b4c6 /src/zenstore/cidstore.cpp | |
| parent | fixed issue where file log sink would get the wrong pattern assigned (#513) (diff) | |
| download | zen-0b184fd2a65852028672a7a0013ec794c7e0b071.tar.xz zen-0b184fd2a65852028672a7a0013ec794c7e0b071.zip | |
statsd for cas (#511)
* separate statsd interfaces so they can be accessible to zenstore
* statsd for cas
Diffstat (limited to 'src/zenstore/cidstore.cpp')
| -rw-r--r-- | src/zenstore/cidstore.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/zenstore/cidstore.cpp b/src/zenstore/cidstore.cpp index f6560fcff..67b7e95ac 100644 --- a/src/zenstore/cidstore.cpp +++ b/src/zenstore/cidstore.cpp @@ -99,13 +99,26 @@ struct CidStore::Impl }; } + void ReportMetrics(StatsMetrics& Statsd) + { + const CidStoreStats Now = Stats(); + const CidStoreStats& Old = m_LastReportedMetrics; + + Statsd.Meter("zen.cas_hits", Now.HitCount - Old.HitCount); + Statsd.Meter("zen.cas_misses", Now.MissCount - Old.MissCount); + Statsd.Meter("zen.cas_writes", Now.WriteCount - Old.WriteCount); + + m_LastReportedMetrics = Now; + } + std::atomic_uint64_t m_HitCount{}; std::atomic_uint64_t m_MissCount{}; std::atomic_uint64_t m_WriteCount{}; metrics::RequestStats m_AddChunkOps; metrics::RequestStats m_FindChunkOps; - // metrics::OperationTiming m_ContainChunkOps; + + CidStoreStats m_LastReportedMetrics; uint64_t m_LastScrubTime = 0; }; @@ -174,4 +187,9 @@ CidStore::Stats() const return m_Impl->Stats(); } +void +CidStore::ReportMetrics(StatsMetrics& Statsd) +{ + return m_Impl->ReportMetrics(Statsd); +} } // namespace zen |