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
This commit is contained in:
Mark Thomas 2018-01-30 09:53:43 -08:00 committed by Saurabh Singh
parent c9914836f9
commit ad1f8c211c

View File

@ -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: