Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(telemetry): anonimized cli options usage, exit-code event, tune …
…timeouts * Send CommandStarted event with additional data: list of cli options names that has been specified (without values). * Send CommandExited event with exit code. * Lower telemetry conn timeouts to 800ms. Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
- Loading branch information
1 parent
b92c9e9
commit 3402424
Showing
6 changed files
with
95 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package telemetry | ||
|
||
type EventType string | ||
|
||
const ( | ||
CommandStartedEvent EventType = "CommandStarted" | ||
CommandExitedEvent EventType = "CommandExited" | ||
) | ||
|
||
type Event interface { | ||
GetType() EventType | ||
GetData() interface{} | ||
} | ||
|
||
func NewCommandStarted(commandOptions []CommandOption) *CommandStarted { | ||
return &CommandStarted{commandOptions: commandOptions} | ||
} | ||
|
||
type CommandStarted struct { | ||
commandOptions []CommandOption | ||
} | ||
|
||
func (e *CommandStarted) GetType() EventType { return CommandStartedEvent } | ||
func (e *CommandStarted) GetData() interface{} { | ||
if len(e.commandOptions) > 0 { | ||
return map[string]interface{}{"commandOptions": e.commandOptions} | ||
} | ||
return nil | ||
} | ||
|
||
func NewCommandExited(exitCode int) *CommandExited { return &CommandExited{exitCode: exitCode} } | ||
|
||
type CommandExited struct { | ||
exitCode int | ||
} | ||
|
||
func (e *CommandExited) GetType() EventType { return CommandExitedEvent } | ||
func (e *CommandExited) GetData() interface{} { return map[string]interface{}{"exitCode": e.exitCode} } |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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