top

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_PADDING_SIZE      = 2
	DEFAULT_PADDING           = "  "
	DEFAULT_HOST_PADDING_SIZE = 15
	UI_HEADER_PREFIX          = "\033[1;1H\033[7;1H"
)
View Source
const DisplaySubscriptions = 1

Variables

This section is empty.

Functions

func Nsize

func Nsize(displayRawValue bool, s int64) string

Nsize takes a float and returns a human readable string.

func Psize

func Psize(displayRawValue bool, s int64) string

Psize takes a float and returns a human readable string (Used for bytes).

func SaveStatsSnapshotToFile

func SaveStatsSnapshotToFile(engine *Engine, outputFile string, outputDelimiter string) error

func StartUI

func StartUI(engine *Engine, lookupDNS bool, rawBytes bool, maxRefresh int)

StartUI periodically refreshes the screen using recent data.

Types

type ConnRates

type ConnRates struct {
	InMsgsRate   float64
	OutMsgsRate  float64
	InBytesRate  float64
	OutBytesRate float64
}

type Engine

type Engine struct {
	Nc           *nats.Conn
	Host         string
	Conns        int
	SortOpt      server.SortOpt
	Delay        int
	DisplaySubs  bool
	StatsCh      chan *Stats
	ShutdownCh   chan struct{}
	LastStats    *Stats
	LastPollTime time.Time
	ShowRates    bool
	LastConnz    map[uint64]*server.ConnInfo
	Trace        bool
}

func NewEngine

func NewEngine(nc *nats.Conn, host string, conns int, delay int, trace bool) *Engine

func (*Engine) FetchStatsSnapshot

func (e *Engine) FetchStatsSnapshot() *Stats

func (*Engine) MonitorStats

func (e *Engine) MonitorStats() error

MonitorStats is ran as a goroutine and takes options which can modify how poll values then sends to channel.

func (*Engine) Request

func (e *Engine) Request(path string) (interface{}, error)

Request takes a path and options, and returns a Stats struct with with either connz or varz

type Rates

type Rates struct {
	InMsgsRate   float64
	OutMsgsRate  float64
	InBytesRate  float64
	OutBytesRate float64
	Connections  map[uint64]*ConnRates
}

Rates represents the tracked in/out msgs and bytes flow from a NATS server.

type RedrawCause

type RedrawCause int
const (
	DueToNewStats RedrawCause = iota
	DueToViewportResize
)

type Stats

type Stats struct {
	Varz  *server.Varz
	Connz *server.Connz
	Rates *Rates
	Error error
}

Stats represents the monitored data from a NATS server.

type ViewMode

type ViewMode int
const (
	TopViewMode ViewMode = iota
	HelpViewMode
)

Jump to

Keyboard shortcuts

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