Documentation ¶
Overview ¶
Package metrics contains expvar & Prometheus types and code used by Tailscale for monitoring.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentFDs ¶ added in v1.16.0
func CurrentFDs() int
CurrentFDs reports how many file descriptors are currently open.
It only works on Linux. It returns zero otherwise.
Types ¶
type Histogram ¶ added in v1.46.0
type Histogram struct {
// contains filtered or unexported fields
}
Histogram is a histogram of values. It should be created with NewHistogram.
func NewHistogram ¶ added in v1.46.0
NewHistogram returns a new histogram that reports to the given expvar map under the given name.
The buckets are the boundaries of the histogram buckets, in increasing order. The last bucket is +Inf.
func (*Histogram) PromExport ¶ added in v1.46.0
PromExport writes the histogram to w in Prometheus exposition format.
type LabelMap ¶
LabelMap is a string-to-Var map variable that satisfies the expvar.Var interface.
Semantically, this is mapped by tsweb's Prometheus exporter as a collection of variables with the same name, with a varying label value. Use this to export things that are intuitively breakdowns into different buckets.
func (*LabelMap) Get ¶
Get returns a direct pointer to the expvar.Int for key, creating it if necessary.
func (*LabelMap) GetFloat ¶ added in v1.0.0
GetFloat returns a direct pointer to the expvar.Float for key, creating it if necessary.
func (*LabelMap) GetIncrFunc ¶ added in v1.46.0
GetIncrFunc returns a function that increments the expvar.Int named by key.
Most callers should not need this; it exists to satisfy an interface elsewhere.
type Set ¶
Set is a string-to-Var map variable that satisfies the expvar.Var interface.
Semantically, this is mapped by tsweb's Prometheus exporter as a collection of unrelated variables exported with a common prefix.
This lets us have tsweb recognize *expvar.Map for different purposes in the future. (Or perhaps all uses of expvar.Map will require explicit types like this one, declaring how we want tsweb to export it to Prometheus.)