Documentation ¶
Index ¶
- Constants
- func WithEventMetadata(ctx context.Context, metadata *CLIAnalyticsEventMetadata) context.Context
- func WithTelemetryClient(ctx context.Context, client TelemetryClient) context.Context
- type AnalyticsTelemetryClient
- type AnalyticsTelemetryLogger
- type CLIAnalyticsEventMetadata
- type NoOpTelemetryClient
- type TelemetryClient
Constants ¶
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.
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()
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)