stats

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const SendStatsThreashhold = 5

Variables

This section is empty.

Functions

func Trim added in v0.1.7

func Trim(s string, size int) string

Types

type CmdCommand

type CmdCommand struct {
	Name  string      `json:"name"`
	Flags []CmdFlag   `json:"flags"`
	Args  []string    `json:"args"`
	Child *CmdCommand `json:"child"`
}

func WrapCmdCommand

func WrapCmdCommand(command *cobra.Command) *CmdCommand

type CmdFlag

type CmdFlag struct {
	Name         string `json:"name"`
	Value        string `json:"value,omitempty"`
	DefaultValue string `json:"default_value"`
	IsChanged    bool   `json:"is_changed"`
}

type Collector

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

func NewCollector

func NewCollector(
	ctx context.Context,
	logger *log.Logger,
	isEnabled bool,
	instanceID string,
	workspaceName string,
	projectName string,
	mifyVersion string,
	apiToken string,
	statsQueueFile string) *Collector

func (*Collector) LogCobraCommandExecuted

func (s *Collector) LogCobraCommandExecuted(cmd *cobra.Command)

func (*Collector) MaybeSendStats added in v0.1.7

func (s *Collector) MaybeSendStats() error

Send all stats saved in queue file (only if there are more then SendStatsThreashhold events)

type Event

type Event struct {
	Id             string `json:"id"`
	UserTime       string `json:"user_time"`
	Name           string `json:"name"`
	MifyVersion    string `json:"mify_version"`
	OS             string `json:"os"`
	Arch           string `json:"arch"`
	MifyInstanceID string `json:"mify_instance_id"`
	WorkspaceName  string `json:"workspace_name"`
	ProjectName    string `json:"project_name"`
	Payload        string `json:"payload"`
}

type RunPayload

type RunPayload struct {
	CmdInfo []CmdCommand `json:"cmd_info"`
}

type SendStatsReq

type SendStatsReq struct {
	Events []Event `json:"events"`
}

Jump to

Keyboard shortcuts

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