package expvar

Import Path
	expvar (on go.dev)

Dependency Relation
	imports 11 packages, and imported by 0 packages

Involved Source Files 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"
Package-Level Type Names (total 7)
/* sort by: | */
Float is a 64-bit float variable that satisfies the [Var] interface. Add adds delta to v. Set sets v to value. (*Float) String() string (*Float) Value() float64 *Float : Var *Float : fmt.Stringer func NewFloat(name string) *Float
Func implements [Var] by calling the function and formatting the returned value using JSON. ( Func) String() string ( Func) Value() any Func : Var Func : fmt.Stringer
Int is a 64-bit integer variable that satisfies the [Var] interface. (*Int) Add(delta int64) (*Int) Set(value int64) (*Int) String() string (*Int) Value() int64 *Int : Var *Int : fmt.Stringer func NewInt(name string) *Int
KeyValue represents a single entry in a [Map]. Key string Value Var
Map is a string-to-Var map variable that satisfies the [Var] interface. Add adds delta to the *[Int] value stored under the given map key. AddFloat adds delta to the *[Float] value stored under the given map key. Delete deletes the given key from the map. Do calls f for each entry in the map. The map is locked during the iteration, but existing entries may be concurrently updated. (*Map) Get(key string) Var Init removes all keys from the map. (*Map) Set(key string, av Var) (*Map) String() string *Map : Var *Map : fmt.Stringer func NewMap(name string) *Map func (*Map).Init() *Map
String is a string variable, and satisfies the [Var] interface. (*String) Set(value string) String implements the [Var] interface. To get the unquoted string use [String.Value]. (*String) Value() string *String : Var *String : fmt.Stringer func NewString(name string) *String
Var is an abstract type for all exported variables. ( Var) String() string *Float Func *Int *Map *String archive/tar.Format *bytes.Buffer crypto.Hash crypto/tls.ClientAuthType crypto/tls.CurveID crypto/tls.QUICEncryptionLevel crypto/tls.SignatureScheme crypto/x509.OID crypto/x509.PublicKeyAlgorithm crypto/x509.SignatureAlgorithm crypto/x509/pkix.Name crypto/x509/pkix.RDNSequence database/sql.IsolationLevel *debug/dwarf.AddrType *debug/dwarf.ArrayType debug/dwarf.Attr *debug/dwarf.BasicType *debug/dwarf.BoolType *debug/dwarf.CharType debug/dwarf.Class *debug/dwarf.ComplexType *debug/dwarf.DotDotDotType *debug/dwarf.EnumType *debug/dwarf.FloatType *debug/dwarf.FuncType *debug/dwarf.IntType *debug/dwarf.PtrType *debug/dwarf.QualType *debug/dwarf.StructType debug/dwarf.Tag debug/dwarf.Type (interface) *debug/dwarf.TypedefType *debug/dwarf.UcharType *debug/dwarf.UintType *debug/dwarf.UnspecifiedType *debug/dwarf.UnsupportedType *debug/dwarf.VoidType debug/elf.Class debug/elf.CompressionType debug/elf.Data debug/elf.DynFlag debug/elf.DynFlag1 debug/elf.DynTag debug/elf.Machine debug/elf.NType debug/elf.OSABI debug/elf.ProgFlag debug/elf.ProgType debug/elf.R_386 debug/elf.R_390 debug/elf.R_AARCH64 debug/elf.R_ALPHA debug/elf.R_ARM debug/elf.R_LARCH debug/elf.R_MIPS debug/elf.R_PPC debug/elf.R_PPC64 debug/elf.R_RISCV debug/elf.R_SPARC debug/elf.R_X86_64 debug/elf.SectionFlag debug/elf.SectionIndex debug/elf.SectionType debug/elf.SymBind debug/elf.SymType debug/elf.SymVis debug/elf.Type debug/elf.Version debug/macho.Cpu debug/macho.LoadCmd debug/macho.RelocTypeARM debug/macho.RelocTypeARM64 debug/macho.RelocTypeGeneric debug/macho.RelocTypeX86_64 debug/macho.Type encoding/asn1.ObjectIdentifier encoding/binary.AppendByteOrder (interface) encoding/binary.ByteOrder (interface) encoding/json.Delim encoding/json.Number flag.Getter (interface) flag.Value (interface) fmt.Stringer (interface) go/ast.CommentMap *go/ast.Ident go/ast.ObjKind *go/ast.Scope *go/build/constraint.AndExpr go/build/constraint.Expr (interface) *go/build/constraint.NotExpr *go/build/constraint.OrExpr *go/build/constraint.TagExpr go/constant.Kind go/constant.Value (interface) go/token.Position go/token.Token *go/types.Alias *go/types.Array *go/types.Basic *go/types.Builtin *go/types.Chan *go/types.Const *go/types.Func *go/types.Initializer *go/types.Interface *go/types.Label *go/types.Map *go/types.MethodSet *go/types.Named *go/types.Nil go/types.Object (interface) *go/types.Package *go/types.PkgName *go/types.Pointer *go/types.Scope *go/types.Selection *go/types.Signature *go/types.Slice *go/types.Struct *go/types.Term *go/types.Tuple go/types.Type (interface) *go/types.TypeName *go/types.TypeParam *go/types.Union *go/types.Var image.Point image.Rectangle image.YCbCrSubsampleRatio internal/abi.Kind *internal/buildcfg.ExperimentFlags internal/coverage.CounterGranularity internal/coverage.CounterMode *internal/godebug.Setting *internal/pkgbits.Decoder internal/pkgbits.SyncMarker internal/platform.OSArch *internal/profile.Profile internal/reflectlite.Type (interface) *internal/trace.Event *internal/trace.Writer internal/trace/v2.Event internal/trace/v2.EventKind internal/trace/v2.GoState internal/trace/v2.ProcState internal/trace/v2.ResourceID internal/trace/v2.ResourceKind internal/trace/v2/event/go122.GoStatus internal/trace/v2/event/go122.ProcStatus *internal/trace/v2/raw.Event internal/types/errors.Code io/fs.FileMode log/slog.Attr log/slog.Kind log/slog.Level *log/slog.LevelVar log/slog.Value *log/slog/internal/buffer.Buffer math/big.Accuracy *math/big.Float *math/big.Int *math/big.Rat math/big.RoundingMode net.Addr (interface) net.Flags net.HardwareAddr net.IP *net.IPAddr net.IPMask *net.IPNet *net.TCPAddr *net.UDPAddr *net.UnixAddr net/http.ConnState *net/http.Cookie net/http/cookiejar.PublicSuffixList (interface) net/internal/socktest.Stat net/internal/socktest.Status *net/mail.Address net/netip.Addr net/netip.AddrPort net/netip.Prefix *net/url.URL *net/url.Userinfo *os.ProcessState os.Signal (interface) *os/exec.Cmd os/exec.ExitError reflect.ChanDir reflect.Kind reflect.Type (interface) reflect.Value *regexp.Regexp regexp/syntax.ErrorCode *regexp/syntax.Inst regexp/syntax.InstOp regexp/syntax.Op *regexp/syntax.Prog *regexp/syntax.Regexp *runtime/debug.BuildInfo *strings.Builder syscall.Signal testing.BenchmarkResult text/scanner.Position text/scanner.Scanner *text/template/parse.ActionNode *text/template/parse.BoolNode *text/template/parse.BranchNode *text/template/parse.BreakNode *text/template/parse.ChainNode *text/template/parse.CommandNode *text/template/parse.CommentNode *text/template/parse.ContinueNode *text/template/parse.DotNode *text/template/parse.FieldNode *text/template/parse.IdentifierNode *text/template/parse.IfNode *text/template/parse.ListNode *text/template/parse.NilNode text/template/parse.Node (interface) *text/template/parse.NumberNode *text/template/parse.PipeNode *text/template/parse.RangeNode *text/template/parse.StringNode *text/template/parse.TemplateNode *text/template/parse.TextNode *text/template/parse.VariableNode *text/template/parse.WithNode time.Duration *time.Location time.Month time.Time time.Weekday vendor/golang.org/x/net/dns/dnsmessage.Class vendor/golang.org/x/net/dns/dnsmessage.Name vendor/golang.org/x/net/dns/dnsmessage.RCode vendor/golang.org/x/net/dns/dnsmessage.Type vendor/golang.org/x/net/http2/hpack.HeaderField *vendor/golang.org/x/net/idna.Profile *vendor/golang.org/x/text/unicode/bidi.Run Var : fmt.Stringer func Get(name string) Var func (*Map).Get(key string) Var func Publish(name string, v Var) func (*Map).Set(key string, av Var)
Package-Level Functions (total 8)
Do calls f for each exported variable. The global variable map is locked during the iteration, but existing entries may be concurrently updated.
Get retrieves a named exported variable. It returns nil if the name has not been registered.
Handler returns the expvar HTTP Handler. This is only needed to install the handler in a non-standard location.
func NewFloat(name string) *Float
func NewInt(name string) *Int
func NewMap(name string) *Map
func NewString(name string) *String
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.