mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
add success field to daemon start logging
Summary: records if a start was successful or not Reviewed By: simpkins Differential Revision: D19817810 fbshipit-source-id: b67253099781bb534b7e2fb26a09ba41c1f0bd69
This commit is contained in:
parent
9c03c5a769
commit
9b8960eef4
@ -247,6 +247,10 @@ int EdenMain::main(int argc, char** argv) {
|
||||
|
||||
prepareFuture = server->prepare(startupLogger, !FLAGS_noWaitForMounts);
|
||||
} catch (const std::exception& ex) {
|
||||
auto startTimeInSeconds =
|
||||
std::chrono::duration<double>{daemonStart.elapsed()}.count();
|
||||
server->getServerState()->getStructuredLogger()->logEvent(
|
||||
DaemonStart{startTimeInSeconds, FLAGS_takeover, false /*success*/});
|
||||
startupLogger->exitUnsuccessfully(
|
||||
EX_SOFTWARE, "error starting edenfs: ", folly::exceptionStr(ex));
|
||||
}
|
||||
@ -268,10 +272,16 @@ int EdenMain::main(int argc, char** argv) {
|
||||
})
|
||||
.ensure(
|
||||
[daemonStart,
|
||||
structuredLogger = server->getServerState()->getStructuredLogger()] {
|
||||
structuredLogger = server->getServerState()->getStructuredLogger(),
|
||||
takeover = FLAGS_takeover] {
|
||||
auto startTimeInSeconds =
|
||||
std::chrono::duration<double>{daemonStart.elapsed()}.count();
|
||||
structuredLogger->logEvent(DaemonStart{startTimeInSeconds});
|
||||
// Here we log a success even if we did not successfully remount
|
||||
// all repositories (if prepareFuture had an exception). In the
|
||||
// future it would be helpful to log number of successful vs
|
||||
// unsuccessful remounts
|
||||
structuredLogger->logEvent(
|
||||
DaemonStart{startTimeInSeconds, takeover, true /*success*/});
|
||||
});
|
||||
|
||||
runServer(server.value());
|
||||
|
@ -42,6 +42,7 @@
|
||||
#endif
|
||||
|
||||
constexpr folly::StringPiece kPeriodicUnloadCounterKey{"PeriodicUnloadCounter"};
|
||||
DECLARE_bool(takeover);
|
||||
|
||||
namespace cpptoml {
|
||||
class table;
|
||||
|
@ -71,9 +71,13 @@ struct DaemonStart {
|
||||
static constexpr const char* type = "daemon_start";
|
||||
|
||||
double duration = 0.0;
|
||||
bool is_takeover = false;
|
||||
bool success = false;
|
||||
|
||||
void populate(DynamicEvent& event) const {
|
||||
event.addDouble("duration", duration);
|
||||
event.addBool("is_takeover", is_takeover);
|
||||
event.addBool("success", success);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user