Skip to content

Commit 23fddd5

Browse files
Chandhana Solainathanmeta-codesync[bot]
authored andcommitted
telemetry: Add structured error logging to PrivHelper bind mount operations
Summary: Adds structured error logging for bind mount and bind unmount failures. These operations go through the privileged helper process and failures are logged with `component=privhelper`. Reviewed By: genevievehelsel Differential Revision: D108644581 fbshipit-source-id: f614a0faae41a60f44548e0a69dfd87dd6fd15e5
1 parent 16bcb2f commit 23fddd5

1 file changed

Lines changed: 37 additions & 5 deletions

File tree

eden/fs/service/EdenServiceHandler.cpp

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,10 +1615,25 @@ folly::SemiFuture<folly::Unit> EdenServiceHandler::semifuture_addBindMount(
16151615
auto fut = mountHandle.getEdenMount().ensureDirectoryExists(
16161616
repoPath, helper->getFetchContext());
16171617
return std::move(fut)
1618-
.thenValue([privHelper,
1618+
.thenValue([self = shared_from_this(),
1619+
privHelper,
16191620
target = absolutePathFromThrift(*targetPath),
1620-
pathInMountDir = absRepoPath.copy()](TreeInodePtr) {
1621-
return privHelper->bindMount(target.view(), pathInMountDir.view());
1621+
pathInMountDir = absRepoPath.copy(),
1622+
mountPath = mountHandle.getEdenMount().getPath().asString(),
1623+
filePath = absRepoPath.asString()](TreeInodePtr) {
1624+
return privHelper->bindMount(target.view(), pathInMountDir.view())
1625+
.thenError([self, mountPath, filePath](
1626+
const folly::exception_wrapper& ex) {
1627+
ex.with_exception([&](const std::exception& e) {
1628+
self->server_->getServerState()->getErrorLogger().log(
1629+
EdenErrorInfo::privhelper(
1630+
ErrorArg::fromExceptionWithoutTrace(e))
1631+
.withMountPoint(mountPath)
1632+
.withFilePath(filePath)
1633+
.withErrorType("bind_mount"));
1634+
});
1635+
throw newEdenError(ex);
1636+
});
16221637
})
16231638
.ensure([mountHandle, helper = std::move(helper)] {})
16241639
.semi();
@@ -1632,8 +1647,25 @@ folly::SemiFuture<folly::Unit> EdenServiceHandler::semifuture_removeBindMount(
16321647

16331648
auto repoPath = RelativePathPiece{*repoPathStr};
16341649
auto absRepoPath = mountHandle.getEdenMount().getPath() + repoPath;
1635-
return server_->getServerState()->getPrivHelper()->bindUnMount(
1636-
absRepoPath.view());
1650+
return server_->getServerState()
1651+
->getPrivHelper()
1652+
->bindUnMount(absRepoPath.view())
1653+
.thenError([this,
1654+
self = shared_from_this(),
1655+
mountPath = mountHandle.getEdenMount().getPath().asString(),
1656+
filePath = absRepoPath.asString()](
1657+
const folly::exception_wrapper& ex) {
1658+
ex.with_exception([&](const std::exception& e) {
1659+
server_->getServerState()->getErrorLogger().log(
1660+
EdenErrorInfo::privhelper(ErrorArg::fromExceptionWithoutTrace(e))
1661+
.withMountPoint(mountPath)
1662+
.withFilePath(filePath)
1663+
.withErrorType("bind_unmount"));
1664+
});
1665+
throw newEdenError(ex);
1666+
})
1667+
.ensure([mountHandle, helper = std::move(helper)] {})
1668+
.semi();
16371669
}
16381670

16391671
void EdenServiceHandler::getCurrentJournalPosition(

0 commit comments

Comments
 (0)