telemetry

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "cli"

Variables

This section is empty.

Functions

func WithEventMetadata

func WithEventMetadata(ctx context.Context, metadata *CLIAnalyticsEventMetadata) context.Context

WithEventMetadata returns a new copy of context.Context with the provided CLIAnalyticsEventMetadata

func WithTelemetryClient

func WithTelemetryClient(ctx context.Context, client TelemetryClient) context.Context

WithTelemetryClient returns a new copy of context.Context with the provided telemetryClient

Types

type AnalyticsTelemetryClient

type AnalyticsTelemetryClient struct {
	// contains filtered or unexported fields
}

func (*AnalyticsTelemetryClient) Close

func (a *AnalyticsTelemetryClient) Close()

Close closes the client, waiting for all pending events to be sent.

func (*AnalyticsTelemetryClient) Identify

func (a *AnalyticsTelemetryClient) Identify(ctx context.Context) error

Identify tracks the user with the provided properties

func (*AnalyticsTelemetryClient) Track

func (a *AnalyticsTelemetryClient) Track(ctx context.Context, event string) error

Track tracks the event with the provided properties

type AnalyticsTelemetryLogger

type AnalyticsTelemetryLogger struct {
	// contains filtered or unexported fields
}

func (AnalyticsTelemetryLogger) Errorf

func (l AnalyticsTelemetryLogger) Errorf(format string, args ...interface{})

func (AnalyticsTelemetryLogger) Logf

func (l AnalyticsTelemetryLogger) Logf(format string, args ...interface{})

type CLIAnalyticsEventMetadata

type CLIAnalyticsEventMetadata struct {
	AnonymousID              string   // the anonymous id is the hash of the mac address of the machine
	UserId                   string   // TODO: Once we implement OAuth
	InvocationID             string   // the invocation id is unique to each context object and represents all events coming from one command
	ConfiguredApplicationsNb int      // the number of configured applications
	AppID                    string   // the app id with which the command was called
	CommandPath              string   // the command path is the full path of the command
	CommandFlags             []string // the command flags is the full list of flags passed to the command
	CLIVersion               string   // the version of the CLI
	OS                       string   // the OS of the system
}

func GetEventMetadata

func GetEventMetadata(ctx context.Context) *CLIAnalyticsEventMetadata

GetEventMetadata returns the CLIAnalyticsEventMetadata from the provided context

func NewEventMetadata

func NewEventMetadata() *CLIAnalyticsEventMetadata

NewEventMetadata initializes an instance of CLIAnalyticsEventContext

func (*CLIAnalyticsEventMetadata) SetAppID

func (e *CLIAnalyticsEventMetadata) SetAppID(appID string)

SetAppID sets the AppID on the CLIAnalyticsEventContext object

func (*CLIAnalyticsEventMetadata) SetCobraCommandContext

func (e *CLIAnalyticsEventMetadata) SetCobraCommandContext(cmd *cobra.Command)

SetCobraCommandContext sets the telemetry values for the command being executed.

func (*CLIAnalyticsEventMetadata) SetCommandPath

func (e *CLIAnalyticsEventMetadata) SetCommandPath(commandPath string)

SetCommandPath sets the commandPath on the CLIAnalyticsEventContext object

func (*CLIAnalyticsEventMetadata) SetConfiguredApplicationsNb

func (e *CLIAnalyticsEventMetadata) SetConfiguredApplicationsNb(nb int)

SetConfiguredApplicationsNb sets the configuredApplicationsNb on the CLIAnalyticsEventContext object

type NoOpTelemetryClient

type NoOpTelemetryClient struct{}

func (*NoOpTelemetryClient) Close

func (a *NoOpTelemetryClient) Close()

func (*NoOpTelemetryClient) Identify

func (a *NoOpTelemetryClient) Identify(ctx context.Context) error

func (*NoOpTelemetryClient) Track

func (a *NoOpTelemetryClient) Track(ctx context.Context, event string) error

type TelemetryClient

type TelemetryClient interface {
	Identify(ctx context.Context) error
	Track(ctx context.Context, event string) error
	Close()
}

func GetTelemetryClient

func GetTelemetryClient(ctx context.Context) TelemetryClient

GetTelemetryClient returns the CLIAnalyticsEventMetadata from the provided context

func NewAnalyticsTelemetryClient

func NewAnalyticsTelemetryClient(debug bool) (TelemetryClient, error)

Jump to

Keyboard shortcuts

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