From ad1f8c211c19bfbd79ffd9dd36fcc3b1e6ca5c0a Mon Sep 17 00:00:00 2001 From: Mark Thomas Date: Tue, 30 Jan 2018 09:53:43 -0800 Subject: [PATCH] fsmonitor: add telemetry for watchman status Summary: Adds telemetry showing the status of watchman during an invocation of HG. The new key, `fsmonitor_status` takes the value: * `exception` if an exception occurred during the call to watchman. * `unavailable` if watchman was unavailable. * `fresh` if a fresh instance of watchman was encountered. * `normal` if watchman was available normally. Differential Revision: D6845070 fbshipit-source-id: 5ccf61a1009cdccbc0d1786b2533c3a7fc6ac2c9 --- hgext/fsmonitor/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py index 6477331ff2..f57eb6d336 100644 --- a/hgext/fsmonitor/__init__.py +++ b/hgext/fsmonitor/__init__.py @@ -177,8 +177,10 @@ def _handleunavailable(ui, state, ex): if ex.invalidate: state.invalidate() ui.log('fsmonitor', 'Watchman unavailable: %s\n', ex.msg) + ui.log('fsmonitor_status', '', fsmonitor_status='unavailable') else: ui.log('fsmonitor', 'Watchman exception: %s\n', ex) + ui.log('fsmonitor_status', '', fsmonitor_status='exception') def _hashignore(ignore): """Calculate hash for ignore patterns and filenames @@ -352,6 +354,11 @@ def overridewalk(orig, self, match, subrepos, unknown, ignored, full=True): # Ignore any prior noteable files from the state info notefiles = [] + if fresh_instance: + self._ui.log('fsmonitor_status', '', fsmonitor_status='fresh') + else: + self._ui.log('fsmonitor_status', '', fsmonitor_status='normal') + # for file paths which require normalization and we encounter a case # collision, we store our own foldmap if normalize: