aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Uzhakov <uzhastik@gmail.com>2022-05-25 20:30:40 +0300
committerSergey Uzhakov <uzhastik@gmail.com>2022-05-25 20:30:40 +0300
commitfb7c6b5131725dd7daac1e273efbcdc06afe7c91 (patch)
treea114eb3415bfe57f1fd0e8812d563d9a0875e1df
parentd302d0c4a3224a001a62fe7343b5d0a79e57fc06 (diff)
downloadydb-fb7c6b5131725dd7daac1e273efbcdc06afe7c91.tar.gz
more sensors in http gateway
ref:4af8726582772a9b27c4331b52f871f215090dd3
-rw-r--r--ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp b/ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp
index aacdfafab73..8ec8f0d6318 100644
--- a/ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp
+++ b/ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp
@@ -223,19 +223,21 @@ public:
, MaxInFlight(Counters->GetCounter("MaxInFlight"))
, AllocatedMemory(Counters->GetCounter("AllocatedMemory"))
, MaxAllocatedMemory(Counters->GetCounter("MaxAllocatedMemory"))
+ , OutputMemory(Counters->GetCounter("OutputMemory"))
+ , PerformCycles(Counters->GetCounter("PerformCycles", true))
+ , AwaitQueue(Counters->GetCounter("AwaitQueue"))
{
- if (!httpGatewaysCfg) {
- return;
- }
- if (httpGatewaysCfg->HasMaxInFlightCount()) {
- MaxHandlers = httpGatewaysCfg->GetMaxInFlightCount();
- }
- MaxInFlight->Set(MaxHandlers);
+ if (httpGatewaysCfg) {
+ if (httpGatewaysCfg->HasMaxInFlightCount()) {
+ MaxHandlers = httpGatewaysCfg->GetMaxInFlightCount();
+ }
+ MaxInFlight->Set(MaxHandlers);
- if (httpGatewaysCfg->HasMaxSimulatenousDownloadsSize()) {
- MaxSimulatenousDownloadsSize = httpGatewaysCfg->GetMaxSimulatenousDownloadsSize();
+ if (httpGatewaysCfg->HasMaxSimulatenousDownloadsSize()) {
+ MaxSimulatenousDownloadsSize = httpGatewaysCfg->GetMaxSimulatenousDownloadsSize();
+ }
+ MaxAllocatedMemory->Set(MaxSimulatenousDownloadsSize);
}
- MaxAllocatedMemory->Set(MaxSimulatenousDownloadsSize);
TaskScheduler.Start();
}
@@ -259,10 +261,13 @@ private:
}
for (size_t handlers = 0U;;) {
- if (const auto& self = weak.lock())
+ if (const auto& self = weak.lock()) {
handlers = self->FillHandlers();
- else
+ self->PerformCycles->Inc();
+ self->OutputMemory->Set(OutputSize);
+ } else {
break;
+ }
int running = 0;
if (const auto c = curl_multi_perform(handle, &running); CURLM_OK != c) {
@@ -307,6 +312,7 @@ private:
Await.pop();
curl_multi_add_handle(Handle, handle);
}
+ AwaitQueue->Set(Await.size());
AllocatedMemory->Set(AllocatedSize);
return Allocated.size();
}
@@ -409,6 +415,7 @@ private:
}
void Wakeup(std::size_t expectedSize) {
+ AwaitQueue->Set(Await.size());
if (Allocated.size() < MaxHandlers && AllocatedSize + expectedSize + OutputSize.load() <= MaxSimulatenousDownloadsSize) {
curl_multi_wakeup(Handle);
}
@@ -460,6 +467,9 @@ private:
const NMonitoring::TDynamicCounters::TCounterPtr MaxInFlight;
const NMonitoring::TDynamicCounters::TCounterPtr AllocatedMemory;
const NMonitoring::TDynamicCounters::TCounterPtr MaxAllocatedMemory;
+ const NMonitoring::TDynamicCounters::TCounterPtr OutputMemory;
+ const NMonitoring::TDynamicCounters::TCounterPtr PerformCycles;
+ const NMonitoring::TDynamicCounters::TCounterPtr AwaitQueue;
TTaskScheduler TaskScheduler;
};