expvar

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	Stat stat.Stat
}

Component implements the settings.Component interface for expvar metrics.

func NewComponent

func NewComponent() *Component

NewComponent generates a blank component instance.

func (*Component) New

func (c *Component) New(_ context.Context, conf *Config) (*Expvar, error)

New produces a ServerFn bound to the given configuration.

func (*Component) Settings

func (*Component) Settings() *Config

Settings returns a configuration with all defaults set.

func (*Component) WithStat

func (c *Component) WithStat(s stat.Stat) *Component

WithStat returns a copy of the component bound to the given Stat instance.

type Config

type Config struct {
	Alloc            string        `description:"Name of the metric tracking allocated bytes"`
	Frees            string        `description:"Name of the metric tracking number of frees"`
	HeapAlloc        string        `description:"Name of the metric tracking allocated bytes"`
	HeapIdle         string        `description:"Name of the metric tracking bytes in unused spans"`
	HeapInuse        string        `description:"Name of the metric tracking bytes in in-use spans"`
	HeapObjects      string        `description:"Name of the metric tracking total number of object allocated"`
	HeapReleased     string        `description:"Name of the metric tracking bytes realeased to the OS"`
	HeapSys          string        `description:"Name of the metric tracking bytes obtained from the system"`
	Lookups          string        `description:"Name of the metric tracking number of pointer lookups"`
	Mallocs          string        `description:"Name of the metric tracking number of mallocs"`
	NumGC            string        `description:"Name of the metric tracking number of garbage collections"`
	PauseNS          string        `description:"Name of the metric tracking duration of GC pauses"`
	PauseTotalNS     string        `description:"Name of the metric tracking total GC pause duration over lifetime process"`
	TotalAlloc       string        `description:"Name of the metric tracking allocated bytes (even if freed)"`
	GoroutinesExists string        `description:"Name of the metric tracking number of active go routines"`
	ReportInterval   time.Duration `description:"Interval on which metrics are reported."`
}

Config is a container for internal expvar metrics settings.

func (*Config) Description

func (*Config) Description() string

Description returns the help information for the configuration root.

func (*Config) Name

func (*Config) Name() string

Name of the configuration root.

type Expvar

type Expvar struct {
	Stat                     stat.Stat
	MemstatsAllocName        string
	MemstatsFreesName        string
	MemstatsHeapAllocName    string
	MemstatsHeapIdleName     string
	MemstatsHeapInuseName    string
	MemstatsHeapObjectsName  string
	MemstatsHeapReleasedName string
	MemstatsHeapSysName      string
	MemstatsLookupsName      string
	MemstatsMallocsName      string
	MemstatsNumGCName        string
	MemstatsPauseNSName      string
	MemstatsPauseTotalNSName string
	MemstatsTotalAllocName   string
	GoroutinesExistsName     string
	Interval                 time.Duration
	// contains filtered or unexported fields
}

Expvar tracks the memory usage of the Go runtime and collects metrics instrumented from Go’s expvar package

func Load

func Load(ctx context.Context, source settings.Source, c *Component) (*Expvar, error)

Load is a convenience method for binding the source to the component.

func (*Expvar) Close

func (e *Expvar) Close() error

Close the reporting loop.

func (*Expvar) Report

func (e *Expvar) Report()

Report loops on a time interval and pushes a set of gauge metrics.

Jump to

Keyboard shortcuts

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