monitor

package
v2.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GaugeRequestCount  = `requestCount`
	GaugeResponseCount = `responseCount`
	GaugeRequestLen    = `requestLen`
	GaugeResponseLen   = `responseLen`
	GaugePanicCount    = `panicCount`
)

Variables

View Source
var (
	PipeTimeout     = time.Second * 3
	StorageLifetime = time.Hour * 24 * 7
)
View Source
var (
	RootPath = `/`
)
View Source
var (
	Seperator byte = '-'
)

Functions

func CodeLineFromRedis

func CodeLineFromRedis(red *redis.Client, m *Monitor, prefix, gaugeName, path string, axisData []string) (seriesData []uint64, codeSeriesData map[codes.Code][]uint64, err error)

func GaugeLineFromRedis

func GaugeLineFromRedis(red *redis.Client, m *Monitor, prefix, gaugeName string, axisData []string) (seriesData []uint64, err error)

Types

type CodeInfo

type CodeInfo struct {
	Info

	GaugeName string `json:"gaugeName"`
}

func (*CodeInfo) Key

func (ci *CodeInfo) Key(appName, prefix string) string

type Gauge

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

func (*Gauge) Set

func (g *Gauge) Set(value uint64)

func (*Gauge) Value

func (g *Gauge) Value() uint64

type Info

type Info struct {
	Name  string `json:"name"`
	Path  string `json:"path"`
	Total uint64 `json:"total"`
	Value uint64 `json:"value"`
	Sub   []Item `json:"sub,omitempty"`
}

func (*Info) Key

func (i *Info) Key(appName, prefix string) string

type Item

type Item struct {
	Name  string     `json:"name"`
	Code  codes.Code `json:"code"`
	Total uint64     `json:"total"`
	Value uint64     `json:"value"`
}

func (*Item) Field

func (it *Item) Field(prefix string) string

type Itp

type Itp struct {
	Gauge
	// contains filtered or unexported fields
}

Itp Increment of time period,某个时间段增量

func NewItp

func NewItp(name string, value uint64) *Itp

func (*Itp) Add

func (i *Itp) Add(delta uint64) (newValue uint64)

func (*Itp) Reset

func (i *Itp) Reset(times int) (value uint64)

func (*Itp) Total

func (i *Itp) Total() uint64

type ItpCode

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

ItpCode Increment of time period code,某个时间段状态码增量

func NewItpCode

func NewItpCode(name string, codeList []codes.Code) *ItpCode

func (*ItpCode) Add

func (ic *ItpCode) Add(code codes.Code, delta uint64) (newValue uint64, exists bool)

func (*ItpCode) AddWithStatus

func (ic *ItpCode) AddWithStatus(sts *components.Status, delta uint64) (newValue uint64, exists bool)

func (*ItpCode) Info

func (ic *ItpCode) Info() (info Info)

func (*ItpCode) Reset

func (ic *ItpCode) Reset(times int)

type ItpCodeGroup

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

ItpCodeGroup Increment of time period group,某个时间段状态码增量组,按照路径划分

func NewItpCodeGroup

func NewItpCodeGroup(name string, codeList []codes.Code) *ItpCodeGroup

func (*ItpCodeGroup) Add

func (icg *ItpCodeGroup) Add(path string, code codes.Code, delta uint64) (newValue uint64, exists bool)

func (*ItpCodeGroup) Info

func (icg *ItpCodeGroup) Info() (info []CodeInfo)

func (*ItpCodeGroup) Path

func (icg *ItpCodeGroup) Path(path, name string) *ItpCodeGroup

func (*ItpCodeGroup) Reset

func (icg *ItpCodeGroup) Reset(times int)

type ItpGroup

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

func NewItpGroup

func NewItpGroup(name string) *ItpGroup

func (*ItpGroup) Add

func (ig *ItpGroup) Add(path string, delta uint64) (newValue uint64, exists bool)

func (*ItpGroup) Info

func (ig *ItpGroup) Info() (info []Info)

func (*ItpGroup) Path

func (ig *ItpGroup) Path(path, name string)

func (*ItpGroup) Reset

func (ig *ItpGroup) Reset(times int)

type Monitor

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

func NewMonitor

func NewMonitor(opt Options) *Monitor

func (*Monitor) Add

func (m *Monitor) Add(gauge, path string, code codes.Code, delta uint64) (newValue uint64, exists bool)

func (*Monitor) AddGauge

func (m *Monitor) AddGauge(gauge string, delta uint64) (newValue uint64, exists bool)

func (*Monitor) AddWithStatus

func (m *Monitor) AddWithStatus(gauge, path string, sts *components.Status, delta uint64) (newValue uint64, exists bool)

func (*Monitor) Info

func (m *Monitor) Info() *MonitorInfo

func (*Monitor) Path

func (m *Monitor) Path(path, name string) *Monitor

func (*Monitor) WithStorage

func (m *Monitor) WithStorage(s Storage) *Monitor

type MonitorInfo

type MonitorInfo struct {
	Name       string                `json:"name"`
	ResetCount uint64                `json:"resetCount"`
	ResetAt    string                `json:"resetAt"`
	CodesInfo  map[string][]CodeInfo `json:"codesInfo"`
	GaugesInfo []Info                `json:"gaugesInfo"`
}

func (*MonitorInfo) Keys

func (mi *MonitorInfo) Keys(prefix string) (gaugeKeys []string, codeKeys []string)

type Options

type Options struct {
	Name         string       `json:"name" yaml:"name"`
	Gauges       []string     `json:"gauges" yaml:"gauges"`
	CodeGauges   []string     `json:"CodeGauges" yaml:"CodeGauges"`
	ResetSeconds int          `json:"resetSeconds" yaml:"resetSeconds"`
	ResetTimes   int          `json:"resetTimes" yaml:"resetTimes"`
	CodeList     []codes.Code `json:"codeList" yaml:"codeList"`
}

type Storage

type Storage func(info *MonitorInfo) error

func RedisStorage

func RedisStorage(red *redis.Client) Storage

Jump to

Keyboard shortcuts

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