diff options
| author | Dan Engelbrecht <[email protected]> | 2023-09-28 23:57:31 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-28 23:57:31 +0200 |
| commit | bf20e4c8e63638792e69098d4d9810c1136ff627 (patch) | |
| tree | fee82fc0d15910902a4a3c24a5564867748b6419 /src/zenserver/cache/cachedisklayer.h | |
| parent | added more context to http response error message (#430) (diff) | |
| download | zen-bf20e4c8e63638792e69098d4d9810c1136ff627.tar.xz zen-bf20e4c8e63638792e69098d4d9810c1136ff627.zip | |
adding more stats (#429)
- Feature: Add detailed stats on requests and data sizes on a per-bucket level, use parameter `cachestorestats=true` on the `/stats/z$` endpoint to enable
- Feature: Add detailed stats on requests and data sizes on cidstore, use parameter `cidstorestats=true` on the `/stats/z$` endpoint to enable
- Feature: Dashboard now accepts parameters in the URL which is passed on to the `/stats/z$` endpoint
Diffstat (limited to 'src/zenserver/cache/cachedisklayer.h')
| -rw-r--r-- | src/zenserver/cache/cachedisklayer.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/zenserver/cache/cachedisklayer.h b/src/zenserver/cache/cachedisklayer.h index fc4d8cd6f..80c643afa 100644 --- a/src/zenserver/cache/cachedisklayer.h +++ b/src/zenserver/cache/cachedisklayer.h @@ -4,6 +4,7 @@ #include "cacheshared.h" +#include <zencore/stats.h> #include <zenstore/blockstore.h> #include <zenstore/caslog.h> @@ -106,6 +107,27 @@ public: uint64_t TotalSize = 0; }; + struct BucketStats + { + uint64_t TotalSize; + uint64_t HitCount; + uint64_t MissCount; + uint64_t WriteCount; + metrics::RequestStatsSnapshot PutOps; + metrics::RequestStatsSnapshot GetOps; + }; + + struct NamedBucketStats + { + std::string BucketName; + BucketStats Stats; + }; + + struct DiskStats + { + std::vector<NamedBucketStats> BucketStats; + }; + explicit ZenCacheDiskLayer(const std::filesystem::path& RootDir); ~ZenCacheDiskLayer(); @@ -119,8 +141,9 @@ public: void CollectGarbage(GcContext& GcCtx); void UpdateAccessTimes(const zen::access_tracking::AccessTimes& AccessTimes); - void DiscoverBuckets(); - uint64_t TotalSize() const; + void DiscoverBuckets(); + uint64_t TotalSize() const; + DiskStats Stats() const; Info GetInfo() const; std::optional<BucketInfo> GetBucketInfo(std::string_view Bucket) const; @@ -150,6 +173,7 @@ private: inline uint64_t TotalSize() const { return m_TotalStandaloneSize.load(std::memory_order::relaxed) + m_BlockStore.TotalSize(); } uint64_t EntryCount() const; + BucketStats Stats(); CacheValueDetails::BucketDetails GetValueDetails(const std::string_view ValueFilter) const; void EnumerateBucketContents(std::function<void(const IoHash& Key, const CacheValueDetails::ValueDetails& Details)>& Fn) const; @@ -184,6 +208,12 @@ private: using IndexMap = tsl::robin_map<IoHash, size_t, IoHash::Hasher>; + std::atomic<uint64_t> m_HitCount; + std::atomic<uint64_t> m_MissCount; + std::atomic<uint64_t> m_WriteCount; + metrics::RequestStats m_PutOps; + metrics::RequestStats m_GetOps; + mutable RwLock m_IndexLock; std::vector<AccessTime> m_AccessTimes; std::vector<BucketPayload> m_Payloads; |