telemetry

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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

type KeyValuePair struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL