telemetry

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MaxTzNameLen = 50

Variables

This section is empty.

Functions

func GetCurDayStr

func GetCurDayStr() string

func GetCustomDayStr

func GetCustomDayStr(format string) (string, error)

accepts a custom format string to return a daystr can be either a prefix, a delta, or a prefix w/ a delta if no prefix is given, "today" is assumed examples: today-2d, bow, bom+1m-1d (that's end of the month), 2024-04-01+1w

prefixes:

yyyy-mm-dd
today
yesterday
bom (beginning of month)
bow (beginning of week -- sunday)

deltas:

+[n]d, -[n]d (e.g. +1d, -5d)
+[n]w, -[n]w (e.g. +2w)
+[n]m, -[n]m (e.g. -1m)
deltas can be combined e.g. +1w-2d

func GetRelDayStr

func GetRelDayStr(relDays int) string

func GoUpdateActivityWrap

func GoUpdateActivityWrap(update ActivityUpdate, debugStr string)

Wraps UpdateCurrentActivity, spawns goroutine, and logs errors

func IsAllowedRenderer

func IsAllowedRenderer(renderer string) bool

func MarkActivityAsUploaded

func MarkActivityAsUploaded(ctx context.Context, activityArr []*ActivityType) error

note, will not mark the current day as uploaded

func UpdateActivity

func UpdateActivity(ctx context.Context, update ActivityUpdate) error

func UpdateFeActivityWrap

func UpdateFeActivityWrap(feActivity *scpacket.FeActivityPacketType)

Types

type ActivityType

type ActivityType struct {
	Day           string        `json:"day"`
	Uploaded      bool          `json:"-"`
	TData         TelemetryData `json:"tdata"`
	TzName        string        `json:"tzname"`
	TzOffset      int           `json:"tzoffset"`
	ClientVersion string        `json:"clientversion"`
	ClientArch    string        `json:"clientarch"`
	BuildTime     string        `json:"buildtime"`
	DefaultShell  string        `json:"defaultshell"`
	OSRelease     string        `json:"osrelease"`
}

func GetNonUploadedActivity

func GetNonUploadedActivity(ctx context.Context) ([]*ActivityType, error)

type ActivityUpdate

type ActivityUpdate struct {
	FgMinutes        int
	ActiveMinutes    int
	OpenMinutes      int
	NumCommands      int
	ClickShared      int
	HistoryView      int
	BookmarksView    int
	NumConns         int
	NumWorkspaces    int
	NumTabs          int
	NewTab           int
	ReinitBashErrors int
	ReinitZshErrors  int
	Startup          int
	Shutdown         int
	FeAIChatOpen     int
	FeHistoryOpen    int
	FeAiCmdInfoOpen  int
	BuildTime        string
	Renderers        map[string]int
}

type TelemetryData

type TelemetryData struct {
	NumCommands      int            `json:"numcommands"`
	ActiveMinutes    int            `json:"activeminutes"`
	FgMinutes        int            `json:"fgminutes"`
	OpenMinutes      int            `json:"openminutes"`
	ClickShared      int            `json:"clickshared,omitempty"`
	HistoryView      int            `json:"historyview,omitempty"`
	BookmarksView    int            `json:"bookmarksview,omitempty"`
	NumConns         int            `json:"numconns"`
	NumWorkspaces    int            `json:"numworkspaces"`
	NumTabs          int            `json:"numtabs"`
	NewTab           int            `json:"newtab"`
	NumStartup       int            `json:"numstartup,omitempty"`
	NumShutdown      int            `json:"numshutdown,omitempty"`
	NumAIChatOpen    int            `json:"numaichatopen,omitempty"`
	NumHistoryOpen   int            `json:"numhistoryopen,omitempty"`
	ReinitBashErrors int            `json:"reinitbasherrors,omitempty"`
	ReinitZshErrors  int            `json:"reinitzsherrors,omitempty"`
	Renderers        map[string]int `json:"renderers,omitempty"`
}

func (*TelemetryData) Scan

func (tdata *TelemetryData) Scan(val interface{}) error

func (TelemetryData) Value

func (tdata TelemetryData) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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