expvar

package
v0.0.0-...-90c9d3a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2010 License: BSD-3-Clause, GooglePatentClause Imports: 6 Imported by: 0

Documentation

Overview

The expvar package 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Iter

func Iter() <-chan KeyValue

func Publish

func Publish(name string, v Var)

Publish declares an 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.Crash.

func RemoveAll

func RemoveAll()

RemoveAll removes all exported variables. This is for tests; don't call this on a real server.

Types

type Int

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

Int is a 64-bit integer variable, and satisfies the Var interface.

func NewInt

func NewInt(name string) *Int

func (*Int) Add

func (v *Int) Add(delta int64)

func (*Int) String

func (v *Int) String() string

type IntFunc

type IntFunc func() int64

IntFunc wraps a func() int64 to create a value that satisfies the Var interface. The function will be called each time the Var is evaluated.

func (IntFunc) String

func (v IntFunc) String() string

type KeyValue

type KeyValue struct {
	Key   string
	Value Var
}

KeyValue represents a single entry in a Map.

type Map

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

Map is a string-to-Var map variable, and satisfies the Var interface.

func NewMap

func NewMap(name string) *Map

func (*Map) Add

func (v *Map) Add(key string, delta int64)

func (*Map) Get

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

func (*Map) Init

func (v *Map) Init() *Map

func (*Map) Iter

func (v *Map) Iter() <-chan KeyValue

func (*Map) Set

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

func (*Map) String

func (v *Map) String() string

type String

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

String is a string variable, and satisfies the Var interface.

func NewString

func NewString(name string) *String

func (*String) Set

func (v *String) Set(value string)

func (*String) String

func (v *String) String() string

type Var

type Var interface {
	String() string
}

Var is an abstract type for all exported variables.

func Get

func Get(name string) Var

Get retrieves a named exported variable.

Jump to

Keyboard shortcuts

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