enable thrift stats

Summary:
In the open source and macOS builds of EdenFS, enable Thrift function
statistics.

Reviewed By: simpkins

Differential Revision: D20550819

fbshipit-source-id: bb6fe2f1f413b89f344cb3725a7382fdb3d50a5d
This commit is contained in:
Chad Austin 2020-03-26 11:53:12 -07:00 committed by Facebook GitHub Bot
parent e815ec7e6d
commit 61d52fe6bc

View File

@ -8,6 +8,7 @@
#include "eden/fs/service/EdenMain.h"
#include <fb303/FollyLoggingHandler.h>
#include <fb303/TFunctionStatHandler.h>
#include <folly/Conv.h>
#include <folly/ScopeGuard.h>
#include <folly/experimental/FunctionScheduler.h>
@ -29,6 +30,7 @@
#include "eden/fs/fuse/privhelper/UserInfo.h"
#include "eden/fs/service/EdenInit.h"
#include "eden/fs/service/EdenServer.h"
#include "eden/fs/service/EdenServiceHandler.h" // for kServiceName
#include "eden/fs/service/StartupLogger.h"
#include "eden/fs/service/Systemd.h"
#include "eden/fs/telemetry/SessionInfo.h"
@ -93,15 +95,17 @@ std::string EdenMain::getLocalHostname() {
}
void EdenMain::runServer(const EdenServer& server) {
fb303::registerFollyLoggingOptionHandlers();
// ThriftServer::serve() will drive the current thread's EventBase.
// Verify that we are being called from the expected thread, and will end up
// driving the EventBase returned by EdenServer::getMainEventBase().
CHECK_EQ(
server.getMainEventBase(),
folly::EventBaseManager::get()->getEventBase());
fb303::registerFollyLoggingOptionHandlers();
fb303::withThriftFunctionStats(kServiceName, server.getHandler().get(), [&] {
server.getServer()->serve();
});
}
int EdenMain::main(int argc, char** argv) {