directory
0.0.0-20210902034828-42829d4bdecd
Repository: https://github.com/baidu/go-lib.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
No description provided by the author
Usage:
import "github.com/baidu/go-lib/web-monitor/metrics"
// define counter struct type
type ServerState {
ReqServed *Counter // field type must be *Counter or *Gauge or *State
ConServed *Counter
ConActive *Gauge
}
// create metrics
var m Metrics
var s ServerState
m.Init(&s, "PROXY", 20)
// counter operations
s.ConActive.Inc(2)
s.ConServed.Inc(1)
s.ReqServed.Inc(1)
s.ConActive.Dec(1)
m.Counter("CounterName").Inc(1)
m.Gauge("GaugeName").Inc(1)
m.State("StateName").Set("StateValue")
// get absoulute data for all metrics
stateData := m.GetAll()
// get diff data for all counters(gauge don't have diff data)
stateDiff := m.GetDiff()
*/.
No description provided by the author
No description provided by the author
No description provided by the author