Documentation
¶
Index ¶
- Variables
- func InvocationIDFromContext(ctx context.Context) (string, bool)
- func NewContext(ctx context.Context, client Client) context.Context
- func SendTelemetryApproval(user User, approval Approval) error
- func TrackWorkflowStep(client Client, workflow, step, invocationID string, ...)
- func UsedFlagValues(cmd *cobra.Command) map[string]string
- func WithInvocationID(ctx context.Context, invocationID string) context.Context
- type Approval
- type Client
- type CommandInfo
- type Event
- func CreateChangeTelemetryStatusEvent(action string, origin string, err error) Event
- func CreateCompletionCommand(cmdInfo CommandInfo) Event
- func CreateConfigEvent(cmdInfo CommandInfo, err error) Event
- func CreateDiagnosticEvent(err error) Event
- func CreateFollowEvent(err error) Event
- func CreateInfoEvent(cmdInfo CommandInfo, err error) Event
- func CreateLocalExecuteEvent(cmdInfo CommandInfo) Event
- func CreateNamespaceEvent(cmdInfo CommandInfo) Event
- func CreateOpenEvent(err error) Event
- func CreateOrbEvent(cmdInfo CommandInfo) Event
- func CreatePolicyEvent(cmdInfo CommandInfo) Event
- func CreateRunnerInstanceEvent(cmdInfo CommandInfo, err error) Event
- func CreateRunnerResourceClassEvent(cmdInfo CommandInfo) Event
- func CreateRunnerTokenEvent(cmdInfo CommandInfo) Event
- func CreateSetupEvent(isServerCustomer bool) Event
- func CreateUpdateEvent(cmdInfo CommandInfo) Event
- func CreateVersionEvent(version string) Event
- type User
Constants ¶
This section is empty.
Variables ¶
var ( // Overwrite this function for tests CreateActiveTelemetry = newSegmentClient SegmentEndpoint = "http://localhost:33457" )
Functions ¶
func InvocationIDFromContext ¶ added in v0.1.34770
InvocationIDFromContext retrieves the invocation ID set by the command middleware. Returns ("", false) if no ID is present.
func SendTelemetryApproval ¶
Sends the user's approval event
func TrackWorkflowStep ¶ added in v0.1.34770
func TrackWorkflowStep(client Client, workflow, step, invocationID string, extra map[string]interface{})
TrackWorkflowStep emits a cli_workflow_step event for a named step within a multi-step command workflow. It lives in the telemetry package so that all subpackages (cmd/project, cmd/pipeline, cmd/trigger, etc.) can call it without creating import cycles back to the cmd package.
func UsedFlagValues ¶ added in v0.1.34770
UsedFlagValues returns a map of flag names to values for flags explicitly set by the user. Sensitive flags (tokens, secrets) have their values redacted.
Types ¶
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
Enabled() bool
}
func CreateClient ¶
Create a telemetry client to be used to send telemetry events
func CreateFileTelemetry ¶
func CreateNullClient ¶
func CreateNullClient() Client
type CommandInfo ¶
func GetCommandInformation ¶
func GetCommandInformation(cmd *cobra.Command, getParent bool) CommandInfo
GetCommandInformation takes a cobra Command and creates a telemetry.CommandInfo. Only flags explicitly set by the user are included (via pflag.Visit, not VisitAll). Values are sent for all flags except those in sensitiveFlags, which are redacted. If getParent is true, explicitly-set flags from the parent command are also included (child flags take precedence over parent flags with the 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 CreateCompletionCommand ¶
func CreateCompletionCommand(cmdInfo CommandInfo) Event
func CreateConfigEvent ¶
func CreateConfigEvent(cmdInfo CommandInfo, err error) Event
func CreateDiagnosticEvent ¶
func CreateFollowEvent ¶
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 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 CreateUpdateEvent ¶
func CreateUpdateEvent(cmdInfo CommandInfo) Event