DisableTelemetryEnv is name of environment variable, if set to true it disables odo telemetry completely hiding even the question
const ( // DisableTelemetryEnv is name of environment variable, if set to true it disables odo telemetry completely. // Setting it to false has the same effect as not setting it at all == does NOT enable telemetry! // This has priority over TelemetryTrackingEnv // // Deprecated: Use TrackingConsentEnv instead. DisableTelemetryEnv = "ODO_DISABLE_TELEMETRY" // TrackingConsentEnv controls whether odo tracks telemetry or not. // Setting it to 'no' has the same effect as DisableTelemetryEnv=true (telemetry is disabled and no question asked) // Settings this to 'yes' skips the question about telemetry and enables user tracking. // Possible values are yes/no. TrackingConsentEnv = "ODO_TRACKING_CONSENT" )
Sanitizer replaces a PII data
const Sanitizer = "XXXX"
const TelemetryClient = "odo"
func ErrorType(err error) string
ErrorType returns the type of error
func GetApikey() string
func GetRegistryOptions(ctx context.Context) registryLibrary.RegistryOptions
GetRegistryOptions returns a populated RegistryOptions object containing all the properties needed to make a devfile registry library call
func GetTelemetryFilePath() string
GetTelemetryFilePath returns the default file path where the generated anonymous ID is stored
func GetUserIdentity(telemetryFilePath string) (string, error)
GetUserIdentity returns the anonymous ID if it exists, else creates a new one and sends the data to Segment
func IsTelemetryEnabled(cfg preference.Client, envConfig config.Configuration) bool
IsTelemetryEnabled returns true if user has consented to telemetry
func IsTrackingConsentEnabled(envConfig *config.Configuration) (value string, enabled bool, present bool, err error)
IsTrackingConsentEnabled returns whether tracking consent is enabled, based on the value of the TrackingConsentEnv environment variable. The second value returned indicates whether the variable is present in the environment.
func RunningInTerminal() bool
RunningInTerminal checks if odo was run from a terminal
func SetError(err error) (errString string)
SetError sanitizes any PII(Personally Identifiable Information) from the error
type Client struct { // SegmentClient helps interact with the segment API SegmentClient analytics.Client // TelemetryFilePath points to the file containing anonymousID used for tracking odo commands executed by the user TelemetryFilePath string }
func NewClient() (*Client, error)
NewClient returns a Client created with the default args
func (c *Client) Close() error
Close client connection and send the data
func (c *Client) Upload(ctx context.Context, data TelemetryData) error
Upload prepares the data to be sent to segment and send it once the client connection closes
type TelemetryData struct { Event string `json:"event"` Properties TelemetryProperties `json:"properties"` }
type TelemetryProperties struct { Duration int64 `json:"duration"` Error string `json:"error"` ErrorType string `json:"errortype"` Success bool `json:"success"` Tty bool `json:"tty"` Version string `json:"version"` CmdProperties map[string]interface{} `json:"cmdProperties"` }