mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
telemetry: truncate fullcommand to 256 bytes
Summary: If users or automation invoke a bunch of really long commands, it can occupy a lot of space in our logs. The full command for really long commands is unlikely to be useful, so let's truncate them to 256 bytes. Reviewed By: ikostia Differential Revision: D19317932 fbshipit-source-id: 428479a18dd7e5a7ae4d8f862cf26c02c15b1fcb
This commit is contained in:
parent
83d46c7c3b
commit
27e9ca5317
@ -93,7 +93,13 @@ def _capabilities(orig, repo, proto):
|
||||
def _runcommand(orig, lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
|
||||
# Record the command that is running in the client telemetry data.
|
||||
_clienttelemetrydata["command"] = cmd
|
||||
_clienttelemetrydata["fullcommand"] = dispatch._formatargs(fullargs)
|
||||
|
||||
fullcommand = dispatch._formatargs(fullargs)
|
||||
# Long invocations can occupy a lot of space in the logs.
|
||||
if len(fullcommand) > 256:
|
||||
fullcommand = fullcommand[:256] + " (truncated)"
|
||||
|
||||
_clienttelemetrydata["fullcommand"] = fullcommand
|
||||
return orig(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user