perf

package
v0.1.2 Latest Latest
Warning

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

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

README

Perf

Perf is a performance test module that is scheduled to run and cache those tests results in redis which can be retrieved later over RMB call.

Perf tests are monitored by noded service from zos modules.

Check the docs

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResultNotFound = errors.New("result not found")
)

Functions

func MustGetZbusClient

func MustGetZbusClient(ctx context.Context) zbus.Client

MustGetZbusClient gets zbus client from the given context

func TryGetZbusClient

func TryGetZbusClient(ctx context.Context) (zbus.Client, error)

TryGetZbusClient tries to get zbus client from the given context

func WithZbusClient

func WithZbusClient(ctx context.Context, client zbus.Client) context.Context

Types

type PerformanceMonitor

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

PerformanceMonitor holds the module data

func NewPerformanceMonitor

func NewPerformanceMonitor(redisAddr string) (*PerformanceMonitor, error)

NewPerformanceMonitor returns PerformanceMonitor instance

func (*PerformanceMonitor) AddTask

func (pm *PerformanceMonitor) AddTask(task Task)

AddTask a simple helper method to add new tasks

func (*PerformanceMonitor) Get

func (pm *PerformanceMonitor) Get(taskName string) (pkg.TaskResult, error)

Get gets data from redis

func (*PerformanceMonitor) GetAll

func (pm *PerformanceMonitor) GetAll() ([]pkg.TaskResult, error)

GetAll gets the results for all the tests with moduleName as prefix

func (*PerformanceMonitor) Run

func (pm *PerformanceMonitor) Run(ctx context.Context) error

Run adds the tasks to the cron queue and start the scheduler

type Task

type Task interface {
	ID() string
	Cron() string
	Description() string
	Jitter() uint32
	Run(ctx context.Context) (interface{}, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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