telemetry

package
v0.0.0-...-77fb227 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyManifest             propertyKeyType = "manifest"
	KeyExitCode             propertyKeyType = "exit-code"
	KeyClient               propertyKeyType = "client"
	KeyTotalVulnerabilities propertyKeyType = "total-vulnerabilities"
	KeyEcosystem            propertyKeyType = "ecosystem"
	KeySnykTokenAssociated  propertyKeyType = "snyk-token-associated"
	KeyJSonOutput           propertyKeyType = "json"
	KeyVerboseOutput        propertyKeyType = "verbose"
	KeySuccess              propertyKeyType = "success"
	KeyPlatform             propertyKeyType = "platform"
	KeyVersion              propertyKeyType = "version"
	KeyDuration             propertyKeyType = "duration"
	KeyError                propertyKeyType = "error"
)

Variables

This section is empty.

Functions

func AskForConsent

func AskForConsent()

AskForConsent is used to prompt the user for selecting Yes|No|Later in regard to telemetry consent Yes or No: config will be updated accordingly, and we won't ask again Later: no updates to config, will ask again

if consent config already recorded, will not ask at all

func GetContext

func GetContext(ctx context.Context) context.Context

GetContext is used for instantiating a value context storing telemetry client and properties invoke this functions once to get the context and pass it back when using telemetry

func GetCreateUserIdentity

func GetCreateUserIdentity(userIdFile string) (string, error)

GetCreateUserIdentity is used for loading or creating a new user id for telemetry reporting will return error if failed loading/creating the uuid for telemetry

func GetProperty

func GetProperty(ctx context.Context, key propertyKeyType) (string, bool)

GetProperty is used to get a stored telemetry event property

func GetUserIdFilePath

func GetUserIdFilePath() string

GetUserIdFilePath is used to construct the path for the telemetry user id the user id is shared between all application using red hat telemetry i.e. vscode rh extensions, intellij rh plugins, etc. $HOME/.redhat/anonymousId

func MaskErrorContent

func MaskErrorContent(err error) string

func PushEvent

func PushEvent(ctx context.Context, segmentClient analytics.Client, userId, eventName string, startTime time.Time) error

PushEvent is used to push a track event the event properties will be fetched from the context the duration wil be calculated based on the start time returns error if failed identifying or pushing the track event to segment

func SetProperty

func SetProperty[T string | bool | int](ctx context.Context, key propertyKeyType, value T)

SetProperty is used to store a string, a bool, or an int as a telemetry event property

Types

This section is empty.

Jump to

Keyboard shortcuts

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