添加监控

This commit is contained in:
aozhiwei 2019-01-15 11:32:41 +08:00
parent 18133846b6
commit fe005a6c44
2 changed files with 13 additions and 0 deletions

View File

@ -135,12 +135,22 @@ namespace f8
switch (node->method) { switch (node->method) {
case 1: case 1:
{ {
long long begin_tick = a8::XGetTickCount();
ret = a8::http::Get(finally_url, response, &node->headers, 10); ret = a8::http::Get(finally_url, response, &node->headers, 10);
long long end_tick = a8::XGetTickCount();
if (end_tick - begin_tick > f8::HttpClientPool::Instance()->max_request_delay) {
f8::HttpClientPool::Instance()->max_request_delay = end_tick - begin_tick;
}
break; break;
} }
case 2: case 2:
{ {
long long begin_tick = a8::XGetTickCount();
ret = a8::http::Post(finally_url.c_str(), node->content, response, &node->headers, 10); ret = a8::http::Post(finally_url.c_str(), node->content, response, &node->headers, 10);
long long end_tick = a8::XGetTickCount();
if (end_tick - begin_tick > f8::HttpClientPool::Instance()->max_request_delay) {
f8::HttpClientPool::Instance()->max_request_delay = end_tick - begin_tick;
}
break; break;
} }
default: default:

View File

@ -13,6 +13,9 @@ namespace f8
HttpClientPool() {}; HttpClientPool() {};
friend class a8::Singleton<HttpClientPool>; friend class a8::Singleton<HttpClientPool>;
public:
volatile long long max_request_delay = 0;
public: public:
void Init(int thread_num); void Init(int thread_num);
void UnInit(); void UnInit();