Documentation
¶
Index ¶
- Constants
- func EmitCommandEvent(cmd *cobra.Command, args []string, exitCode int, runtimeCtx *runtime.Context, ...)
- func SendEvent(ctx context.Context, event UserEventInput, creds *credentials.Credentials, ...)
- type ActorInfo
- type CommandInfo
- type KeyValuePair
- type MachineInfo
- type ReportUserEventResponse
- type UserEventInput
- type WorkflowInfo
Constants ¶
const ( // TelemetryDisabledEnvVar is the environment variable that disables telemetry when set TelemetryDisabledEnvVar = "CRE_TELEMETRY_DISABLED" // TelemetryDebugEnvVar is the environment variable that enables debug logging for telemetry TelemetryDebugEnvVar = "CRE_TELEMETRY_DEBUG" )
Variables ¶
This section is empty.
Functions ¶
func EmitCommandEvent ¶
func EmitCommandEvent(cmd *cobra.Command, args []string, exitCode int, runtimeCtx *runtime.Context, err error)
EmitCommandEvent emits a user event for command execution This function is completely silent and never blocks command execution
func SendEvent ¶
func SendEvent(ctx context.Context, event UserEventInput, creds *credentials.Credentials, envSet *environments.EnvironmentSet, logger *zerolog.Logger)
SendEvent sends a user event to the GraphQL endpoint All errors are silently swallowed unless debug logging is enabled
Types ¶
type ActorInfo ¶
type ActorInfo struct {
UserID string `json:"userId,omitempty"`
OrganizationID string `json:"organizationId,omitempty"`
MachineID string `json:"machineId"`
}
ActorInfo contains information about the actor performing the action
func CollectActorInfo ¶
func CollectActorInfo() *ActorInfo
CollectActorInfo returns actor information (only machineId, server populates userId/orgId)
type CommandInfo ¶
type CommandInfo struct {
Action string `json:"action"`
Subcommand string `json:"subcommand,omitempty"`
Args []string `json:"args,omitempty"`
Flags []KeyValuePair `json:"flags,omitempty"`
}
CommandInfo contains information about the executed command
func CollectCommandInfo ¶
func CollectCommandInfo(cmd *cobra.Command, args []string) CommandInfo
CollectCommandInfo extracts command information from a cobra command
type KeyValuePair ¶
KeyValuePair represents a key-value pair for flags and attributes
type MachineInfo ¶
type MachineInfo struct {
OsName string `json:"osName"`
OsVersion string `json:"osVersion"`
Architecture string `json:"architecture"`
}
MachineInfo contains information about the machine running the CLI
func CollectMachineInfo ¶
func CollectMachineInfo() MachineInfo
CollectMachineInfo gathers information about the machine running the CLI
type ReportUserEventResponse ¶
type ReportUserEventResponse struct {
ReportUserEvent struct {
Success bool `json:"success"`
Message string `json:"message"`
} `json:"reportUserEvent"`
}
ReportUserEventResponse represents the response from the reportUserEvent mutation
type UserEventInput ¶
type UserEventInput struct {
CliVersion string `json:"cliVersion"`
ExitCode int `json:"exitCode"`
ErrorMessage string `json:"errorMessage,omitempty"`
Command CommandInfo `json:"command"`
Machine MachineInfo `json:"machine"`
Workflow *WorkflowInfo `json:"workflow,omitempty"`
Actor *ActorInfo `json:"actor,omitempty"`
Attributes []KeyValuePair `json:"attributes,omitempty"`
}
UserEventInput represents the input for reporting a user event
type WorkflowInfo ¶
type WorkflowInfo struct {
OwnerAddress string `json:"ownerAddress,omitempty"`
Name string `json:"name,omitempty"`
ID string `json:"id,omitempty"`
Language string `json:"language,omitempty"`
}
WorkflowInfo contains information about the workflow being operated on
func CollectWorkflowInfo ¶
func CollectWorkflowInfo(settings interface{}) *WorkflowInfo
CollectWorkflowInfo extracts workflow information from settings