toputils

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const DisplaySubscriptions = 1

Variables

This section is empty.

Functions

func Psize

func Psize(displayRawValue bool, s int64) string

Psize takes a float and returns a human readable string.

Types

type ConnRates added in v0.6.0

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

type Engine added in v0.1.1

type Engine struct {
	Host         string
	Port         int
	HttpClient   *http.Client
	Uri          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
}

func NewEngine added in v0.1.1

func NewEngine(host string, port int, conns int, delay int) *Engine

func (*Engine) FetchStatsSnapshot added in v0.5.0

func (engine *Engine) FetchStatsSnapshot() *Stats

func (*Engine) MonitorStats added in v0.1.1

func (engine *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 added in v0.1.1

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

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

func (*Engine) SetupHTTP added in v0.1.1

func (engine *Engine) SetupHTTP()

SetupHTTP sets up the http client and uri to use for polling.

func (*Engine) SetupHTTPS added in v0.1.1

func (engine *Engine) SetupHTTPS(caCertOpt, certOpt, keyOpt string, skipVerifyOpt bool) error

SetupHTTPS sets up the http client and uri to use for polling.

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 Stats

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

Stats represents the monitored data from a NATS server.

Jump to

Keyboard shortcuts

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