common/Common.hpp | 14 ++++++++++++++ kit/Kit.cpp | 2 +- wsd/DocumentBroker.cpp | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-)
New commits: commit 9f5bd850080ef6b258d6e9f7b43b1148f23bc52c Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Mon Aug 24 00:17:49 2020 -0400 Commit: Ashod Nakashian <a...@collabora.com> CommitDate: Wed Aug 26 17:47:50 2020 +0200 wsd: use a shared threadname suffix for each document The use of a common threadname suffix in the WSD and Kit processes is intentional. It is designed to help filter for a single document's logs across both processes. The thread name has nothing to do with the classes in the code, nor is it intended to imply any relationship except with the process and the document in question. As the comment in this patch explains, the choice of the suffix is arbitrary and while it may be changed, it has to be sensible and common between the two threads to allow for easy grepping. Historically, there were in fact dedicated threads within the respective "broker" classes, but this fact should be safely ignored, since at the log level we care less about which part of the code generates a log entry (that info, if needed, is at the end of each log entry, in the form of filename and line number), rather we care more about which document it relates to, which is crucial in investigating production issues. Logs and code structure are only incidentally related. Logs are (or at least should be) designed around the execution structure, not code architecture. (This reverts 2a16f34812cf69bbe0f21b7e7d048fdb3271fa9d) Change-Id: Ic6fe2f9425998824774d2644fe4362e75dea6b88 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101261 Tested-by: Jenkins Tested-by: Tor Lillqvist <t...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tor Lillqvist <t...@collabora.com> diff --git a/common/Common.hpp b/common/Common.hpp index d2cc933d6..f036f9219 100644 --- a/common/Common.hpp +++ b/common/Common.hpp @@ -40,6 +40,20 @@ constexpr const char FORKIT_URI[] = "/loolws/forkit"; constexpr const char CAPABILITIES_END_POINT[] = "/hosting/capabilities"; +/// A shared threadname suffix in both the WSD and Kit processes +/// is highly helpful for filtering the logs for the same document +/// by simply grepping for this shared suffix+ID. e.g. 'grep "broker_123" loolwsd.log' +/// Unfortunately grepping for only "_123" would include more noise than desirable. +/// This also makes the threadname symmetric and the entries aligned. +/// The choice of "broker" as the suffix is historic: it implies the controller +/// of which there are two: one in WSD called DocumentBroker and one in Kit +/// called Document, which wasn't called DocumentBroker to avoid confusing it +/// with the one in WSD. No such confusion should be expected in the logs, since +/// the prefix is "doc" and "kit" respectively, and each log entry has the process +/// name prefixed. And of course these threads are unrelated to the classes in +/// the code: they are logical execution unit names. +#define SHARED_DOC_THREADNAME_SUFFIX "broker_" + /// The HTTP response User-Agent. #define HTTP_AGENT_STRING "LOOLWSD HTTP Agent " LOOLWSD_VERSION diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 30cd4e5f8..87335ecaa 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -1879,7 +1879,7 @@ protected: URI::decode(docKey, url); LOG_INF("New session [" << sessionId << "] request on url [" << url << "]."); #ifndef IOS - Util::setThreadName("kit_" + docId); + Util::setThreadName("kit" SHARED_DOC_THREADNAME_SUFFIX + docId); #endif if (!_document) { diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 4218b9fb4..4924d5c9f 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -187,7 +187,7 @@ DocumentBroker::DocumentBroker(ChildType type, _cursorPosY(0), _cursorWidth(0), _cursorHeight(0), - _poll(new DocumentBrokerPoll("docbroker_" + _docId, *this)), + _poll(new DocumentBrokerPoll("doc" SHARED_DOC_THREADNAME_SUFFIX + _docId, *this)), _stop(false), _closeReason("stopped"), _lockCtx(new LockContext()), _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits