monitoring

package
v3.0.0-alpha.24 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 23 Imported by: 11

README

Akita Monitoring Tool

Akita Monitoring Tool is a tool that allows users to monitor the simulation status while the simulation is running. It also provides simple solutions for users to control the running simulation.

Use

If you want to develop a simulator that supports real-time monitoring, you can initiate the monitor in your configuration code. You also need to register the simulator engine with the RegisterEngine function of the Monitor struct. Also, you need to register all the components that you want to monitor with the RegisterComponent function of the Monitor struct.

Before the simulation starts, call the StartServer function of the monitor. A web server will be hosted and the port will be printed to standard error output.

You can use a web browser to access the monitoring tool hosted at the given port.

Development

  1. Make sure you have NodeJS and npm installed.
  2. In the web folder, type npm install to install dependencies.
  3. In the web folder, run npm run watch to use Webpack to build static assets.
  4. Set environment variable AKITA_MONITOR_DEV to the true to enable the development mode. In development mode, your modification to the frontend code will be reflected without recompiling the simulation.

Documentation

Overview

Package monitoring provides a solution that allows monitoring simulation externally.

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
}

Monitor can turn a simulation into a server and allows external monitoring controlling of the simulation.

func NewMonitor

func NewMonitor() *Monitor

NewMonitor creates a new Monitor

func (*Monitor) CompleteProgressBar

func (m *Monitor) CompleteProgressBar(pb *ProgressBar)

CompleteProgressBar removes a bar to be shown on the webpage.

func (*Monitor) CreateProgressBar

func (m *Monitor) CreateProgressBar(name string, total uint64) *ProgressBar

CreateProgressBar creates a new progress bar.

func (*Monitor) RegisterComponent

func (m *Monitor) RegisterComponent(c sim.Component)

RegisterComponent register a component to be monitored.

func (*Monitor) RegisterEngine

func (m *Monitor) RegisterEngine(e sim.Engine)

RegisterEngine registers the engine that is used in the simulation.

func (*Monitor) StartServer

func (m *Monitor) StartServer()

StartServer starts the monitor as a web server with a custom port if wanted.

func (*Monitor) WithPortNumber

func (m *Monitor) WithPortNumber(portNumber int) *Monitor

WithPortNumber sets the port number of the monitor.

type ProgressBar

type ProgressBar struct {
	sync.Mutex
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	StartTime  time.Time `json:"start_time"`
	Total      uint64    `json:"total"`
	Finished   uint64    `json:"finished"`
	InProgress uint64    `json:"in_progress"`
}

A ProgressBar is a tracker of the progress

func (*ProgressBar) IncrementFinished

func (b *ProgressBar) IncrementFinished(amount uint64)

IncrementFinished add a certain amount to finished element.

func (*ProgressBar) IncrementInProgress

func (b *ProgressBar) IncrementInProgress(amount uint64)

IncrementInProgress adds the number of in-progress element.

func (*ProgressBar) MoveInProgressToFinished

func (b *ProgressBar) MoveInProgressToFinished(amount uint64)

MoveInProgressToFinished reduces the number of in progress item by a certain amount and increase the finished item by the same amount.

Directories

Path Synopsis
Package web includes the static web pages for the monitoring tool.
Package web includes the static web pages for the monitoring tool.

Jump to

Keyboard shortcuts

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