Record proxied exit codes and subcommands in command telemetry#396
Draft
gtsiolis wants to merge 1 commit into
Draft
Record proxied exit codes and subcommands in command telemetry#396gtsiolis wants to merge 1 commit into
gtsiolis wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
exit status 252recently became the top-ranked lstk error in analytics, but the telemetry behind that ranking flattens every command failure toexit_code=1with the raw error string as the only signal, and records nothing about which proxied invocation failed. That makes questions like "what is driving the 252s" unanswerable (see the triage on the ticket).Changes
lstk_commandtelemetry: the newcmd.ExitCodehelper maps a proxied tool's*exec.ExitErrorand the--jsonconvention'soutput.ExitCodeErrorto their exact codes, and is now shared bymain.go,instrumentCommands, anddispatchExtension, so the recordedexit_codealways matches the process exit codeparameters.subcommandfield for the proxy commands (aws,az,terraform,cdk,sam): the leading service/operation tokens of the wrapped invocation (e.g.s3 ls). Collection stops at the first flag-like arg and is capped at two tokens of 64 runes, so flag values and free-form input are never recordedmain.gonow derives them from the shared helperTests
cmd.ExitCodeandproxySubcommand(flag-value safety, token cap, truncation, lstk global-flag stripping)subcommandfield (present for proxies, omitted when empty)lstk aws s3 lssagainst a fakeawsexiting 252: asserts the process exits 252 and the telemetry event carriescommand=aws,subcommand="s3 lss",exit_code=252(verified failing before the change, passing after)Towards DEVX-1003