Documentation ¶
Index ¶
- Constants
- Variables
- func GetCommand(args []string) string
- func HasQuietFlag(args []string) bool
- func Track(context string, args []string, status string)
- func WrapCategorisedComposeError(err error, failure FailureCategory) error
- func WrapComposeError(err error) error
- type Client
- type Command
- type ComposeError
- type FailureCategory
Constants ¶
View Source
const ( // APISource is sent for API metrics APISource = "api" // SuccessStatus command success SuccessStatus = "success" // FailureStatus command failure FailureStatus = "failure" // ComposeParseFailureStatus failure while parsing compose file ComposeParseFailureStatus = "failure-compose-parse" // FileNotFoundFailureStatus failure getting compose file FileNotFoundFailureStatus = "failure-file-not-found" // CommandSyntaxFailureStatus failure reading command CommandSyntaxFailureStatus = "failure-cmd-syntax" // BuildFailureStatus failure building imge BuildFailureStatus = "failure-build" // PullFailureStatus failure pulling imge PullFailureStatus = "failure-pull" // CanceledStatus command canceled CanceledStatus = "canceled" )
Variables ¶
View Source
var ( // FileNotFoundFailure failure for compose file not found FileNotFoundFailure = FailureCategory{MetricsStatus: FileNotFoundFailureStatus, ExitCode: 14} // ComposeParseFailure failure for composefile parse error ComposeParseFailure = FailureCategory{MetricsStatus: ComposeParseFailureStatus, ExitCode: 15} // CommandSyntaxFailure failure for command line syntax CommandSyntaxFailure = FailureCategory{MetricsStatus: CommandSyntaxFailureStatus, ExitCode: 16} //BuildFailure failure while building images. BuildFailure = FailureCategory{MetricsStatus: BuildFailureStatus, ExitCode: 17} // PullFailure failure while pulling image PullFailure = FailureCategory{MetricsStatus: PullFailureStatus, ExitCode: 18} )
View Source
var CLISource = "cli"
CLISource is sent for cli metrics
Functions ¶
func HasQuietFlag ¶ added in v1.0.13
HasQuietFlag returns true if one of the arguments is `--quiet` or `-q`
func WrapCategorisedComposeError ¶ added in v1.0.13
func WrapCategorisedComposeError(err error, failure FailureCategory) error
WrapCategorisedComposeError wraps the error if not nil, otherwise returns nil
func WrapComposeError ¶ added in v1.0.13
WrapComposeError wraps the error if not nil, otherwise returns nil
Types ¶
type Client ¶
type Client interface { // Send sends the command to Docker Desktop. Note that the function doesn't // return anything, not even an error, this is because we don't really care // if the metrics were sent or not. We only fire and forget. Send(Command) }
Client sends metrics to Docker Desktopn
type Command ¶
type Command struct { Command string `json:"command"` Context string `json:"context"` Source string `json:"source"` Status string `json:"status"` }
Command is a command
type ComposeError ¶ added in v1.0.13
type ComposeError struct { Err error Category *FailureCategory }
ComposeError error to categorize failures and extract metrics info
func (ComposeError) Error ¶ added in v1.0.13
func (e ComposeError) Error() string
func (ComposeError) GetMetricsFailureCategory ¶ added in v1.0.13
func (e ComposeError) GetMetricsFailureCategory() FailureCategory
GetMetricsFailureCategory get metrics status and error code corresponding to this error
func (ComposeError) Unwrap ¶ added in v1.0.13
func (e ComposeError) Unwrap() error
Unwrap get underlying error
type FailureCategory ¶ added in v1.0.13
FailureCategory sruct regrouping metrics failure status and specific exit code
func ByExitCode ¶ added in v1.0.14
func ByExitCode(exitCode int) FailureCategory
ByExitCode retrieve FailureCategory based on command exit code
Source Files ¶
Click to show internal directories.
Click to hide internal directories.