20
20
#include < folly/synchronization/Latch.h>
21
21
#include < velox/common/base/Exceptions.h>
22
22
#include " presto_cpp/main/common/Configs.h"
23
+ #include " presto_cpp/main/common/Counters.h"
23
24
#include " presto_cpp/main/common/Utils.h"
24
25
#include " presto_cpp/main/http/HttpClient.h"
26
+ #include " velox/common/base/StatsReporter.h"
25
27
26
28
namespace facebook ::presto::http {
27
29
@@ -168,7 +170,8 @@ HttpResponse::nextAllocationSize(uint64_t dataLength) const {
168
170
}
169
171
170
172
std::string HttpResponse::dumpBodyChain () const {
171
- return bodyChain_.empty () ? " Empty response" : util::extractMessageBody (bodyChain_);
173
+ return bodyChain_.empty () ? " Empty response"
174
+ : util::extractMessageBody (bodyChain_);
172
175
}
173
176
174
177
class ResponseHandler : public proxygen ::HTTPTransactionHandler {
@@ -448,7 +451,10 @@ folly::SemiFuture<proxygen::HTTPTransaction*> HttpClient::createTransaction(
448
451
}
449
452
auto idleSessionFuture = idleSessions_->getIdleSession ();
450
453
auto getFromIdleSession =
451
- [self = shared_from_this (), this , handler](
454
+ [self = shared_from_this (),
455
+ this ,
456
+ handler,
457
+ startTimeMs = velox::getCurrentTimeMs ()](
452
458
proxygen::HTTPSessionBase* session) -> proxygen::HTTPTransaction* {
453
459
if (!session) {
454
460
return nullptr ;
@@ -472,6 +478,9 @@ folly::SemiFuture<proxygen::HTTPTransaction*> HttpClient::createTransaction(
472
478
nullptr ,
473
479
nullptr );
474
480
sessionPool_->putSession (session);
481
+ RECORD_HISTOGRAM_METRIC_VALUE (
482
+ kCounterHTTPClientTransactionCreateDelay ,
483
+ velox::getCurrentTimeMs () - startTimeMs);
475
484
return sessionPool_->getTransaction (handler);
476
485
};
477
486
if (idleSessionFuture.isReady ()) {
0 commit comments