Documentation ¶
Overview ¶
package metric provides a collection of useful/built-in metrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶ added in v0.0.8
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 Handler ¶ added in v0.0.8
Handler returns the metrics HTTP Handler.
This is only needed to install the handler in a non-standard location.
func Publish ¶ added in v0.0.8
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 PublishCommandLine ¶ added in v0.0.8
func PublishCommandLine()
PublishCommandLine publish command line information.
func PublishMemoryStats ¶ added in v0.0.8
func PublishMemoryStats()
PublishMemoryStats publish memory stats.
func RegisterHandler ¶ added in v0.0.8
func RegisterHandler()
RegisterHandler registers the standard metrics endpoint: `GET /debug/vars`.
Types ¶
type Float ¶ added in v0.0.8
type Float struct {
// contains filtered or unexported fields
}
Float is a 64-bit float variable that satisfies the Var interface.
type Func ¶ added in v0.0.8
type Func func() interface{}
Func implements Var by calling the function and formatting the returned value using JSON.
type Int ¶ added in v0.0.8
type Int struct {
// contains filtered or unexported fields
}
Int is a 64-bit integer variable that satisfies the Var interface.
type Map ¶ added in v0.0.8
type Map struct {
// contains filtered or unexported fields
}
Map is a string-to-Var map variable that satisfies the Var interface.
func (*Map) AddFloat ¶ added in v0.0.8
AddFloat adds delta to the *Float value stored under the given map key.
type Metric ¶
type Metric struct { // Name of the metric. Name string `json:"name" validate:"required"` // Var is a valid ExpVar. Value Var `json:"value" validate:"required"` }
Metric definition.
type String ¶ added in v0.0.8
type String struct {
// contains filtered or unexported fields
}
String is a string variable, and satisfies the Var interface.