telemetry

package
v0.1.31151 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Overwrite this function for tests
	CreateActiveTelemetry = newSegmentClient

	SegmentEndpoint = "http://localhost:33457"
)

Functions

func NewContext

func NewContext(ctx context.Context, client Client) context.Context

func SendTelemetryApproval

func SendTelemetryApproval(user User, approval Approval) error

Sends the user's approval event

Types

type Approval

type Approval string
const (
	Enabled  Approval = "enabled"
	Disabled Approval = "disabled"
	NoStdin  Approval = "disabled_default"
)

type Client

type Client interface {
	io.Closer
	// Send a telemetry event. This method is not to be called directly. Use config.Track instead
	Track(event Event) error
}

func CreateClient

func CreateClient(user User, enabled bool) Client

Create a telemetry client to be used to send telemetry events

func CreateFileTelemetry

func CreateFileTelemetry(filePath string) Client

func CreateNullClient

func CreateNullClient() Client

func FromContext

func FromContext(ctx context.Context) (Client, bool)

type CommandInfo

type CommandInfo struct {
	Name      string
	LocalArgs map[string]string
}

func GetCommandInformation

func GetCommandInformation(cmd *cobra.Command, getParent bool) CommandInfo

Utility function used when creating telemetry events. It takes a cobra Command and creates a telemetry.CommandInfo of it If getParent is true, puts both the command's args in `LocalArgs` and the parent's args Else only put the command's args Note: child flags overwrite parent flags with same name

type Event

type Event struct {
	Object     string                 `json:"object"`
	Action     string                 `json:"action"`
	Properties map[string]interface{} `json:"properties"`
}

A segment event to be sent to the telemetry Important: this is not meant to be constructed directly apart in tests If you want to create a new event, add its constructor in ./events.go

func CreateChangeTelemetryStatusEvent

func CreateChangeTelemetryStatusEvent(action string, origin string, err error) Event

func CreateCompletionCommand

func CreateCompletionCommand(cmdInfo CommandInfo) Event

func CreateConfigEvent

func CreateConfigEvent(cmdInfo CommandInfo, err error) Event

func CreateDiagnosticEvent

func CreateDiagnosticEvent(err error) Event

func CreateFollowEvent

func CreateFollowEvent(err error) Event

func CreateInfoEvent

func CreateInfoEvent(cmdInfo CommandInfo, err error) Event

func CreateLocalExecuteEvent

func CreateLocalExecuteEvent(cmdInfo CommandInfo) Event

func CreateNamespaceEvent

func CreateNamespaceEvent(cmdInfo CommandInfo) Event

func CreateOpenEvent

func CreateOpenEvent(err error) Event

func CreateOrbEvent

func CreateOrbEvent(cmdInfo CommandInfo) Event

func CreatePolicyEvent

func CreatePolicyEvent(cmdInfo CommandInfo) Event

func CreateRunnerInstanceEvent

func CreateRunnerInstanceEvent(cmdInfo CommandInfo, err error) Event

func CreateRunnerResourceClassEvent

func CreateRunnerResourceClassEvent(cmdInfo CommandInfo) Event

func CreateRunnerTokenEvent added in v0.1.29041

func CreateRunnerTokenEvent(cmdInfo CommandInfo) Event

func CreateSetupEvent

func CreateSetupEvent(isServerCustomer bool) Event

func CreateUpdateEvent

func CreateUpdateEvent(cmdInfo CommandInfo) Event

func CreateVersionEvent

func CreateVersionEvent(version string) Event

type User

type User struct {
	UniqueID     string
	UserID       string
	IsSelfHosted bool
	OS           string
	Version      string
	TeamName     string
}

Jump to

Keyboard shortcuts

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