diff options
author | uzhas <uzhas@ydb.tech> | 2022-10-21 13:54:48 +0300 |
---|---|---|
committer | uzhas <uzhas@ydb.tech> | 2022-10-21 13:54:48 +0300 |
commit | 8d3ca53613d5819111cb0f7a6e10640bac71d40e (patch) | |
tree | 6990a6655a28810400e339ab0d2abf396e7de56d | |
parent | 3f1c6722c965cb3b5406ab0fded6f99a42384206 (diff) | |
download | ydb-8d3ca53613d5819111cb0f7a6e10640bac71d40e.tar.gz |
report curl error code in sensors
-rw-r--r-- | ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp | 42 |
1 files changed, 26 insertions, 16 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 294202a2a60..85c1df9273d 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 @@ -641,24 +641,34 @@ private: const std::unique_lock lock(Sync); if (const auto it = Allocated.find(handle); Allocated.cend() != it) { easy = std::move(it->second); + TString codeLabel; + TString codeValue; if (CURLE_OK == result) { curl_easy_getinfo(easy->GetHandle(), CURLINFO_RESPONSE_CODE, &httpResponseCode); - TIntrusivePtr<::NMonitoring::TDynamicCounters> group; - switch (easy->GetMetthod()) { - case TEasyCurl::EMethod::GET: - group = GroupForGET->GetSubgroup("code", ToString(httpResponseCode)); - break; - case TEasyCurl::EMethod::POST: - group = GroupForPOST->GetSubgroup("code", ToString(httpResponseCode)); - break; - case TEasyCurl::EMethod::PUT: - group = GroupForPUT->GetSubgroup("code", ToString(httpResponseCode)); - break; - default: - break; - } - if (group) - group->GetCounter("count", true)->Inc(); + codeLabel = "code"; + codeValue = ToString(httpResponseCode); + } else { + codeLabel = "curl_code"; + codeValue = ToString((int)result); + } + + TIntrusivePtr<::NMonitoring::TDynamicCounters> group; + switch (easy->GetMetthod()) { + case TEasyCurl::EMethod::GET: + group = GroupForGET->GetSubgroup(codeLabel, codeValue); + break; + case TEasyCurl::EMethod::POST: + group = GroupForPOST->GetSubgroup(codeLabel, codeValue); + break; + case TEasyCurl::EMethod::PUT: + group = GroupForPUT->GetSubgroup(codeLabel, codeValue); + break; + default: + break; + } + + if (group) { + group->GetCounter("count", true)->Inc(); } if (auto buffer = std::dynamic_pointer_cast<TEasyCurlBuffer>(easy)) { |