aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-30 14:45:07 +0200
committerStefan Boberg <[email protected]>2021-09-30 14:45:07 +0200
commit56ac15aa5d44a7564497fc4e7f252d135a1904a4 (patch)
treeb7e1e1d8afdf93c19c79cfbd0b586178f5cc0f02
parentmetrics: added OperationTiming which is a useful combination of a Meter and a... (diff)
downloadzen-56ac15aa5d44a7564497fc4e7f252d135a1904a4.tar.xz
zen-56ac15aa5d44a7564497fc4e7f252d135a1904a4.zip
structured cache: Rewrote metrics tracking using OperationTiming
-rw-r--r--zenserver/cache/structuredcache.cpp8
-rw-r--r--zenserver/cache/structuredcache.h4
2 files changed, 3 insertions, 9 deletions
diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp
index c3b60ea8d..c71beb700 100644
--- a/zenserver/cache/structuredcache.cpp
+++ b/zenserver/cache/structuredcache.cpp
@@ -194,10 +194,7 @@ HttpStructuredCacheService::HandleRequest(HttpServerRequest& Request)
{
CacheRef Ref;
- m_HttpRequestMeter.Mark(1);
-
- Stopwatch Timer;
- auto _ = MakeGuard([&] { m_HttpRequests.Update(Timer.GetElapsedTicks()); });
+ metrics::OperationTiming::Scope $(m_HttpRequests);
if (!ValidateKeyUri(Request, /* out */ Ref))
{
@@ -846,9 +843,8 @@ HttpStructuredCacheService::HandleStatusRequest(zen::HttpServerRequest& Request)
{
CbObjectWriter Cbo;
Cbo << "ok" << true;
-
+
EmitSnapshot("requests", m_HttpRequests, Cbo);
- EmitSnapshot("request_rate", m_HttpRequestMeter, Cbo);
Request.WriteResponse(HttpResponseCode::OK, Cbo.Save());
}
diff --git a/zenserver/cache/structuredcache.h b/zenserver/cache/structuredcache.h
index f68efa3fd..47fc173e9 100644
--- a/zenserver/cache/structuredcache.h
+++ b/zenserver/cache/structuredcache.h
@@ -88,9 +88,7 @@ private:
zen::CidStore& m_CidStore;
std::unique_ptr<UpstreamCache> m_UpstreamCache;
uint64_t m_LastScrubTime = 0;
-
- metrics::Histogram m_HttpRequests;
- metrics::Meter m_HttpRequestMeter;
+ metrics::OperationTiming m_HttpRequests;
};
} // namespace zen