metric

package
v0.0.0-...-873fb03 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CommonsRepoAdded = ""
	RepoName         = ""
)
View Source
var (
	BasicUser = ""
	BasicPass = ""
)
View Source
var (
	ServerRestURL = ""
	ServerGrpcURL = ""
	FilePath      = filepath.Join(api.RitchieHomeDir(), "metrics")
)

Functions

This section is empty.

Types

type APIData

type APIData struct {
	Id         Id          `json:"metricId"`
	UserId     UserId      `json:"userId"`
	Timestamp  time.Time   `json:"timestamp"`
	Os         string      `json:"os"`
	RitVersion string      `json:"ritVersion"`
	Data       interface{} `json:"data"`
}

type CheckManager

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

func NewChecker

func NewChecker(file stream.FileReadExister) CheckManager

func (CheckManager) Check

func (c CheckManager) Check() bool

type Checker

type Checker interface {
	Check() bool
}

type Collector

type Collector interface {
	Collect(commandExecutionTime float64, ritVersion string, commandError ...string) (APIData, error)
}

type Data

type Data struct {
	CommandError         string       `json:"commandError,omitempty"`
	CommonsRepoAdded     string       `json:"commonsRepoAdded,omitempty"`
	CommandExecutionTime float64      `json:"commandExecutionTime"`
	MetricsAcceptance    string       `json:"metricsAcceptance,omitempty"`
	FormulaRepo          formula.Repo `json:"repo,omitempty"`
	Flags                []string     `json:"flags,omitempty"`
}

type DataCollectorManager

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

func NewDataCollector

func NewDataCollector(
	userId UserIdGenerator,
	ritchieHomeDir string,
	file stream.FileReader,
) DataCollectorManager

func (DataCollectorManager) Collect

func (d DataCollectorManager) Collect(
	commandExecutionTime float64,
	ritVersion string,
	commandError ...string,
) (APIData, error)

type Id

type Id string

func (Id) String

func (i Id) String() string

type SendManagerHttp

type SendManagerHttp struct {
	URL string
	// contains filtered or unexported fields
}

func NewHttpSender

func NewHttpSender(url string, client *http.Client) SendManagerHttp

func (SendManagerHttp) Send

func (sm SendManagerHttp) Send(APIData APIData)

type SendManagerRpc

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

func NewRpcSender

func NewRpcSender(processClient pb.ProcessorClient) SendManagerRpc
 Example of how to create a grpc client and processor client:
 ctx, cancel := context.WithTimeout(context.Background(), time.Second)
	defer cancel()
	conn, _ := grpc.DialContext(ctx, "localhost:50080", grpc.WithInsecure(), grpc.WithBlock())

	if conn != nil {
		defer conn.Close()
	}

	processorClient := pb.NewProcessorClient(conn)

func (SendManagerRpc) Send

func (sm SendManagerRpc) Send(apiData APIData)

type Sender

type Sender interface {
	Send(metric APIData)
}

type UserId

type UserId string

func (UserId) String

func (u UserId) String() string

type UserIdGenerator

type UserIdGenerator interface {
	Generate() (UserId, error)
}

type UserIdManager

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

func NewUserIdGenerator

func NewUserIdGenerator() UserIdManager

func (UserIdManager) Generate

func (us UserIdManager) Generate() (UserId, error)

Jump to

Keyboard shortcuts

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