telemetry

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ControlTelemetryEnv = "RHOAS_TELEMETRY"

ControlTelemetryEnv is name of environment variable, if set to false it disables telemetry completely hiding even the question

View Source
const Sanitizer = "XXXX"

Sanitizer replaces a PII data

Variables

This section is empty.

Functions

func GetUserIdentity

func GetUserIdentity(client *TelemetryClient, telemetryFilePath string) (string, error)

GetUserIdentity returns the anonymous ID if it exists, else creates a new one and sends the data to Segment

func SanitizeError

func SanitizeError(err error) (errString string)

SanitizeError sanitizes any PII(Personally Identifiable Information) from the error

Types

type Telemetry

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

Telemetry structure

func CreateTelemetry

func CreateTelemetry(f *factory.Factory) (*Telemetry, error)

Start collecting telemetry data

func (*Telemetry) Finish

func (t *Telemetry) Finish(event string, cmdError error)

Finish sending data to telemetry service

func (*Telemetry) Init

func (t *Telemetry) Init() error

type TelemetryClient

type TelemetryClient 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
}

TelemetryClient client used to send data to Segment

func NewClient

func NewClient() (*TelemetryClient, error)

NewClient returns a Client created with the default args

func (*TelemetryClient) Close

func (c *TelemetryClient) Close() error

Close client connection and send the data

func (*TelemetryClient) Upload

func (c *TelemetryClient) Upload(data *TelemetryData) error

Upload prepares the data to be sent to segment and send it once the client connection closes

type TelemetryData

type TelemetryData struct {
	Event      string              `json:"event"`
	Properties TelemetryProperties `json:"properties"`
}

TelemetryData contains all of the data that is sent to Segment for telemetry

type TelemetryProperties

type TelemetryProperties struct {
	Duration int64  `json:"duration"`
	Error    string `json:"error"`
	Success  bool   `json:"success"`
	TTY      bool   `json:"tty"`
	Version  string `json:"version"`
	OS       string `json:"os"`
}

TelemetryProperties contains all of the properties that are sent as the telemetry data

Jump to

Keyboard shortcuts

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