aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/storage
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-03-27 16:23:59 +0100
committerGitHub Enterprise <[email protected]>2026-03-27 16:23:59 +0100
commitaff16da9a634ff6869b0394bf936bbb45096ad54 (patch)
tree3d88cc842e6a87c3e4d07cc838a31b8dbabfce9a /src/zenserver/storage
parentremove CPR HTTP client backend (#894) (diff)
downloadzen-aff16da9a634ff6869b0394bf936bbb45096ad54.tar.xz
zen-aff16da9a634ff6869b0394bf936bbb45096ad54.zip
dashboard improvements (#896)
- Feature: Added Workspaces dashboard page with HTTP request stats and per-workspace metrics - Feature: Added Build Storage dashboard page with service-specific HTTP request stats - Improvement: Front page now shows Hub and Object Store activity tiles; HTTP panel is fixed above the tiles grid - Improvement: HTTP stats tiles now include 5m/15m rates and p999/max latency across all service pages
Diffstat (limited to 'src/zenserver/storage')
-rw-r--r--src/zenserver/storage/cache/httpstructuredcache.cpp91
-rw-r--r--src/zenserver/storage/objectstore/objectstore.cpp17
-rw-r--r--src/zenserver/storage/objectstore/objectstore.h3
-rw-r--r--src/zenserver/storage/projectstore/httpprojectstore.cpp20
-rw-r--r--src/zenserver/storage/workspaces/httpworkspaces.cpp20
5 files changed, 43 insertions, 108 deletions
diff --git a/src/zenserver/storage/cache/httpstructuredcache.cpp b/src/zenserver/storage/cache/httpstructuredcache.cpp
index 81e244aff..c1727270c 100644
--- a/src/zenserver/storage/cache/httpstructuredcache.cpp
+++ b/src/zenserver/storage/cache/httpstructuredcache.cpp
@@ -1843,12 +1843,6 @@ HttpStructuredCacheService::HandleStatsRequest(HttpServerRequest& Request)
bool ShowCidStoreStats = Request.GetQueryParams().GetValue("cidstorestats") == "true";
bool ShowCacheStoreStats = Request.GetQueryParams().GetValue("cachestorestats") == "true";
- if (!ShowCidStoreStats && !ShowCacheStoreStats)
- {
- Request.WriteResponse(HttpResponseCode::OK, CollectStats());
- return;
- }
-
// Full stats with optional detailed store/cid breakdowns
CbObjectWriter Cbo;
@@ -2058,54 +2052,17 @@ HttpStructuredCacheService::HandleStatsRequest(HttpServerRequest& Request)
CbObject
HttpStructuredCacheService::CollectStats()
{
+ ZEN_TRACE_CPU("HttpStructuredCacheService::Stats");
ZEN_MEMSCOPE(GetCacheHttpTag());
CbObjectWriter Cbo;
EmitSnapshot("requests", m_HttpRequests, Cbo);
- const uint64_t HitCount = m_CacheStats.HitCount;
- const uint64_t UpstreamHitCount = m_CacheStats.UpstreamHitCount;
- const uint64_t MissCount = m_CacheStats.MissCount;
- const uint64_t WriteCount = m_CacheStats.WriteCount;
- const uint64_t BadRequestCount = m_CacheStats.BadRequestCount;
- struct CidStoreStats StoreStats = m_CidStore.Stats();
- const uint64_t ChunkHitCount = StoreStats.HitCount;
- const uint64_t ChunkMissCount = StoreStats.MissCount;
- const uint64_t ChunkWriteCount = StoreStats.WriteCount;
- const uint64_t TotalCount = HitCount + MissCount;
-
- const uint64_t RpcRequests = m_CacheStats.RpcRequests;
- const uint64_t RpcRecordRequests = m_CacheStats.RpcRecordRequests;
- const uint64_t RpcRecordBatchRequests = m_CacheStats.RpcRecordBatchRequests;
- const uint64_t RpcValueRequests = m_CacheStats.RpcValueRequests;
- const uint64_t RpcValueBatchRequests = m_CacheStats.RpcValueBatchRequests;
- const uint64_t RpcChunkRequests = m_CacheStats.RpcChunkRequests;
- const uint64_t RpcChunkBatchRequests = m_CacheStats.RpcChunkBatchRequests;
-
- const CidStoreSize CidSize = m_CidStore.TotalSize();
const CacheStoreSize CacheSize = m_CacheStore.TotalSize();
Cbo.BeginObject("cache");
{
- Cbo << "badrequestcount" << BadRequestCount;
- Cbo.BeginObject("rpc");
- Cbo << "count" << RpcRequests;
- Cbo << "ops" << RpcRecordBatchRequests + RpcValueBatchRequests + RpcChunkBatchRequests;
- Cbo.BeginObject("records");
- Cbo << "count" << RpcRecordRequests;
- Cbo << "ops" << RpcRecordBatchRequests;
- Cbo.EndObject();
- Cbo.BeginObject("values");
- Cbo << "count" << RpcValueRequests;
- Cbo << "ops" << RpcValueBatchRequests;
- Cbo.EndObject();
- Cbo.BeginObject("chunks");
- Cbo << "count" << RpcChunkRequests;
- Cbo << "ops" << RpcChunkBatchRequests;
- Cbo.EndObject();
- Cbo.EndObject();
-
Cbo.BeginObject("size");
{
Cbo << "disk" << CacheSize.DiskSize;
@@ -2113,51 +2070,7 @@ HttpStructuredCacheService::CollectStats()
}
Cbo.EndObject();
- Cbo << "hits" << HitCount << "misses" << MissCount << "writes" << WriteCount;
- Cbo << "hit_ratio" << (TotalCount > 0 ? (double(HitCount) / double(TotalCount)) : 0.0);
-
- if (m_UpstreamCache.IsActive())
- {
- Cbo << "upstream_ratio" << (HitCount > 0 ? (double(UpstreamHitCount) / double(HitCount)) : 0.0);
- Cbo << "upstream_hits" << m_CacheStats.UpstreamHitCount;
- }
-
- Cbo << "cidhits" << ChunkHitCount << "cidmisses" << ChunkMissCount << "cidwrites" << ChunkWriteCount;
-
- {
- ZenCacheStore::CacheStoreStats StoreStatsData = m_CacheStore.Stats();
- Cbo.BeginObject("store");
- Cbo << "hits" << StoreStatsData.HitCount << "misses" << StoreStatsData.MissCount << "writes" << StoreStatsData.WriteCount
- << "rejected_writes" << StoreStatsData.RejectedWriteCount << "rejected_reads" << StoreStatsData.RejectedReadCount;
- const uint64_t StoreTotal = StoreStatsData.HitCount + StoreStatsData.MissCount;
- Cbo << "hit_ratio" << (StoreTotal > 0 ? (double(StoreStatsData.HitCount) / double(StoreTotal)) : 0.0);
- EmitSnapshot("read", StoreStatsData.GetOps, Cbo);
- EmitSnapshot("write", StoreStatsData.PutOps, Cbo);
- Cbo.EndObject();
- }
- }
- Cbo.EndObject();
-
- if (m_UpstreamCache.IsActive())
- {
- EmitSnapshot("upstream_gets", m_UpstreamGetRequestTiming, Cbo);
- Cbo.BeginObject("upstream");
- {
- m_UpstreamCache.GetStatus(Cbo);
- }
- Cbo.EndObject();
- }
-
- Cbo.BeginObject("cid");
- {
- Cbo.BeginObject("size");
- {
- Cbo << "tiny" << CidSize.TinySize;
- Cbo << "small" << CidSize.SmallSize;
- Cbo << "large" << CidSize.LargeSize;
- Cbo << "total" << CidSize.TotalSize;
- }
- Cbo.EndObject();
+ Cbo << "hits" << m_CacheStats.HitCount << "misses" << m_CacheStats.MissCount;
}
Cbo.EndObject();
diff --git a/src/zenserver/storage/objectstore/objectstore.cpp b/src/zenserver/storage/objectstore/objectstore.cpp
index dec0c3cee..d6516fa1a 100644
--- a/src/zenserver/storage/objectstore/objectstore.cpp
+++ b/src/zenserver/storage/objectstore/objectstore.cpp
@@ -226,7 +226,7 @@ HttpObjectStoreService::HttpObjectStoreService(HttpStatsService& StatsService, H
, m_StatusService(StatusService)
, m_Cfg(std::move(Cfg))
{
- Inititalize();
+ Initialize();
m_StatsService.RegisterHandler("obj", *this);
m_StatusService.RegisterHandler("obj", *this);
}
@@ -266,12 +266,19 @@ HttpObjectStoreService::HandleStatusRequest(HttpServerRequest& Request)
void
HttpObjectStoreService::HandleStatsRequest(HttpServerRequest& Request)
{
+ Request.WriteResponse(HttpResponseCode::OK, CollectStats());
+}
+
+CbObject
+HttpObjectStoreService::CollectStats()
+{
+ ZEN_TRACE_CPU("HttpObjectStoreService::Stats");
CbObjectWriter Cbo;
EmitSnapshot("requests", m_HttpRequests, Cbo);
Cbo << "total_bytes_served" << m_TotalBytesServed.load();
- Request.WriteResponse(HttpResponseCode::OK, Cbo.Save());
+ return Cbo.Save();
}
uint64_t
@@ -281,12 +288,12 @@ HttpObjectStoreService::GetActivityCounter()
}
void
-HttpObjectStoreService::Inititalize()
+HttpObjectStoreService::Initialize()
{
- ZEN_TRACE_CPU("HttpObjectStoreService::Inititalize");
+ ZEN_TRACE_CPU("HttpObjectStoreService::Initialize");
namespace fs = std::filesystem;
- ZEN_LOG_INFO(LogObj, "Initialzing Object Store in '{}'", m_Cfg.RootDirectory);
+ ZEN_LOG_INFO(LogObj, "Initializing Object Store in '{}'", m_Cfg.RootDirectory);
const fs::path BucketsPath = m_Cfg.RootDirectory / "buckets";
if (!IsDir(BucketsPath))
diff --git a/src/zenserver/storage/objectstore/objectstore.h b/src/zenserver/storage/objectstore/objectstore.h
index 8a25e750b..f51254357 100644
--- a/src/zenserver/storage/objectstore/objectstore.h
+++ b/src/zenserver/storage/objectstore/objectstore.h
@@ -35,10 +35,11 @@ public:
virtual void HandleRequest(HttpServerRequest& Request) override;
virtual void HandleStatusRequest(HttpServerRequest& Request) override;
virtual void HandleStatsRequest(HttpServerRequest& Request) override;
+ virtual CbObject CollectStats() override;
virtual uint64_t GetActivityCounter() override;
private:
- void Inititalize();
+ void Initialize();
std::filesystem::path GetBucketDirectory(std::string_view BucketName);
void ListBuckets(HttpRouterRequest& Request);
void CreateBucket(HttpRouterRequest& Request);
diff --git a/src/zenserver/storage/projectstore/httpprojectstore.cpp b/src/zenserver/storage/projectstore/httpprojectstore.cpp
index 9d132a22a..a7c8c66b6 100644
--- a/src/zenserver/storage/projectstore/httpprojectstore.cpp
+++ b/src/zenserver/storage/projectstore/httpprojectstore.cpp
@@ -848,12 +848,6 @@ HttpProjectService::HandleStatusRequest(HttpServerRequest& Request)
void
HttpProjectService::HandleStatsRequest(HttpServerRequest& HttpReq)
{
- HttpReq.WriteResponse(HttpResponseCode::OK, CollectStats());
-}
-
-CbObject
-HttpProjectService::CollectStats()
-{
ZEN_TRACE_CPU("ProjectService::Stats");
const GcStorageSize StoreSize = m_ProjectStore->StorageSize();
@@ -863,6 +857,8 @@ HttpProjectService::CollectStats()
EmitSnapshot("requests", m_HttpRequests, Cbo);
+ Cbo << "project_count" << (uint64_t)m_ProjectStore->ProjectCount();
+
Cbo.BeginObject("store");
{
Cbo.BeginObject("size");
@@ -918,6 +914,18 @@ HttpProjectService::CollectStats()
}
Cbo.EndObject();
+ HttpReq.WriteResponse(HttpResponseCode::OK, Cbo.Save());
+}
+
+CbObject
+HttpProjectService::CollectStats()
+{
+ CbObjectWriter Cbo;
+ // CollectStats does not use the HandleStatsRequest implementation to get stats since it uses some heavy operations such as
+ // m_ProjectStore->StorageSize();
+ EmitSnapshot("requests", m_HttpRequests, Cbo);
+ Cbo << "project_count" << (uint64_t)m_ProjectStore->ProjectCount();
+
return Cbo.Save();
}
diff --git a/src/zenserver/storage/workspaces/httpworkspaces.cpp b/src/zenserver/storage/workspaces/httpworkspaces.cpp
index 0119912e9..12e7bae73 100644
--- a/src/zenserver/storage/workspaces/httpworkspaces.cpp
+++ b/src/zenserver/storage/workspaces/httpworkspaces.cpp
@@ -122,13 +122,6 @@ HttpWorkspacesService::HandleStatusRequest(HttpServerRequest& Request)
void
HttpWorkspacesService::HandleStatsRequest(HttpServerRequest& HttpReq)
{
- HttpReq.WriteResponse(HttpResponseCode::OK, CollectStats());
-}
-
-CbObject
-HttpWorkspacesService::CollectStats()
-{
- ZEN_TRACE_CPU("WorkspacesService::Stats");
CbObjectWriter Cbo;
EmitSnapshot("requests", m_HttpRequests, Cbo);
@@ -165,6 +158,19 @@ HttpWorkspacesService::CollectStats()
}
Cbo.EndObject();
+ HttpReq.WriteResponse(HttpResponseCode::OK, Cbo.Save());
+}
+
+CbObject
+HttpWorkspacesService::CollectStats()
+{
+ ZEN_TRACE_CPU("HttpWorkspacesService::Stats");
+ CbObjectWriter Cbo;
+
+ EmitSnapshot("requests", m_HttpRequests, Cbo);
+
+ Cbo << "workspaces" << m_Workspaces.GetWorkspaces().size();
+
return Cbo.Save();
}