telemetry

package
v1.0.7-beta Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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() error

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 CLIAnalyticsEventMetadata

type CLIAnalyticsEventMetadata struct {
	UserId                   string // the user id is the mac address of the machine
	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
	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() error

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() error
}

func GetTelemetryClient

func GetTelemetryClient(ctx context.Context) TelemetryClient

GetTelemetryClient returns the CLIAnalyticsEventMetadata from the provided context

func NewAnalyticsTelemetryClient

func NewAnalyticsTelemetryClient() (TelemetryClient, error)

Jump to

Keyboard shortcuts

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