performance

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

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

func NewMonitor

func NewMonitor(config MonitorConfig, log *mlog.Logger) (*Monitor, error)

NewMonitor creates and initializes a new Monitor.

func (*Monitor) Run

func (m *Monitor) Run() <-chan Status

Run will start the performance monitoring process.

func (*Monitor) Stop

func (m *Monitor) Stop()

Stop will stop the monitoring process.

type MonitorConfig

type MonitorConfig struct {
	// The URL of the Prometheus server to query.
	PrometheusURL string `default:"http://localhost:9090" validate:"url"`
	// The time interval in milliseconds to wait before querying again.
	UpdateIntervalMs int `default:"2000" validate:"range:[1000,]"`
	// The slice of queries to run.
	Queries []prometheus.Query `default_size:"0"`
}

MonitorConfig holds the necessary information to create a Monitor.

func (MonitorConfig) IsValid

func (c MonitorConfig) IsValid() error

IsValid checks whether a MonitorConfig is valid or not. Returns an error if the validation fails.

type Status

type Status struct {
	// A boolean value indicating if performance degradation occurred.
	Alert bool
}

Status is a structure containing information on the performance status of the target instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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