monitor

package
v0.0.0-...-a8d7af0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Overview

Package monitor provides an embedded HTTP server to expose metrics for monitoring

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VarsToString

func VarsToString() string

VarsToString gives a string with all exported variables the returned string is in a pretty format.

Types

type LatencyHistogram

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

LatencyHistogram contains the data needed to properly export itself to expvar and provide a pretty printed version

func NewLatencyHistogram

func NewLatencyHistogram(name string, latencyUnit time.Duration, numBuckets int,
	growth float64, smallest float64, minValue int64) *LatencyHistogram

NewLatencyHistogram creates a new histogram and registers an HTTP handler for it.

func (*LatencyHistogram) Print

func (h *LatencyHistogram) Print() string

Print returns the histogram as a chart

func (*LatencyHistogram) String

func (h *LatencyHistogram) String() string

String returns the histogram as JSON.

func (*LatencyHistogram) UpdateLatencyValues

func (h *LatencyHistogram) UpdateLatencyValues(delta time.Duration)

UpdateLatencyValues updates the LatencyHistogram's buckets with the new datapoint and updates the string associated with the expvar.String

type Map

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

Map is a string-to-Var map variable that satisfies the Var interface. This a streamlined, more efficient version of expvar.Map, that also supports deletion.

func NewMap

func NewMap(name string) *Map

NewMap creates a new Map and publishes it with the given name.

func (*Map) Delete

func (v *Map) Delete(key string)

Delete atomically deletes the given key if it exists.

func (*Map) Do

func (v *Map) Do(f func(expvar.KeyValue))

Do calls f for each entry in the map. The map is locked during the iteration, but existing entries may be concurrently updated.

func (*Map) Get

func (v *Map) Get(key string) expvar.Var

Get atomically returns the Var for the given key or nil.

func (*Map) Set

func (v *Map) Set(key string, av expvar.Var)

Set atomically associates the given Var to the given key.

func (*Map) String

func (v *Map) String() string

type PrintableHistogram

type PrintableHistogram interface {
	Print() string
}

PrintableHistogram represents a Histogram that can be printed as a chart.

type Server

type Server interface {
	Run(serveMux *http.ServeMux)
	Serve(serveMux *http.ServeMux) error
}

Server represents a monitoring server

func NewServer

func NewServer(address string) Server

NewServer creates a new server struct

type Uint

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

Uint is a 64-bit unsigned integer variable that satisfies the Var interface.

func (*Uint) Add

func (v *Uint) Add(delta uint64)

Add delta

func (*Uint) Get

func (v *Uint) Get() uint64

Get the uint64 stored in the Uint

func (*Uint) Set

func (v *Uint) Set(value uint64)

Set value

func (*Uint) String

func (v *Uint) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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