Documentation ¶
Overview ¶
Package expvar provides a standardized interface to public variables, such as operation counters in servers. It exposes these variables via HTTP at /debug/vars in JSON format.
Operations to set or modify these public variables are atomic.
In addition to adding the HTTP handler, this package registers the following variables:
cmdline os.Args memstats runtime.Memstats
The package is sometimes only imported for the side effect of registering its HTTP handler and the above variables. To use it this way, link this package into your program:
import _ "expvar"
Index ¶
- func DeBarDo(f func(KeyValue))
- func Do(f func(KeyValue))
- func GetExpvarString() string
- func Handler() http.Handler
- func Publish(name string, v Var)
- func RegistChanMonitor(name string, chanptr interface{}) bool
- type ChanInfo
- type Float
- type Func
- type Int
- type KeyValue
- type Map
- func (v *Map) Add(key string, delta int64)
- func (v *Map) AddFloat(key string, delta float64)
- func (v *Map) AddMessage(key string, delta, time int64)
- func (v *Map) Delete(key string)
- func (v *Map) Do(f func(KeyValue))
- func (v *Map) Get(key string) Var
- func (v *Map) Init() *Map
- func (v *Map) Set(key string, av Var)
- func (v *Map) String() string
- type Message
- type String
- type Var
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶
func Do(f func(KeyValue))
Do calls f for each exported variable. The global variable map is locked during the iteration, but existing entries may be concurrently updated.
func GetExpvarString ¶
func GetExpvarString() string
func Handler ¶
Handler returns the expvar HTTP Handler.
This is only needed to install the handler in a non-standard location.
func Publish ¶
Publish declares a named exported variable. This should be called from a package's init function when it creates its Vars. If the name is already registered then this will log.Panic.
func RegistChanMonitor ¶
RegistChanMonitor 注册管道监控
Types ¶
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float is a 64-bit float variable that satisfies the Var interface.
type Func ¶
type Func func() interface{}
Func implements Var by calling the function and formatting the returned value using JSON.
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int is a 64-bit integer variable that satisfies the Var interface.
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a string-to-Var map variable that satisfies the Var interface.
func (*Map) AddMessage ¶
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a string variable, and satisfies the Var interface.