Documentation ¶
Overview ¶
Package varz contains code to export metrics in Prometheus format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(w http.ResponseWriter, r *http.Request)
Handler is an HTTP handler to write expvar values into the prometheus export format:
https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md
It makes the following assumptions:
- *expvar.Int are counters (unless marked as a gauge_; see below)
- a *tailscale/metrics.Set is descended into, joining keys with underscores. So use underscores as your metric names.
- an expvar named starting with "gauge_" or "counter_" is of that Prometheus type, and has that prefix stripped.
- anything else is untyped and thus not exported.
- expvar.Func can return an int or int64 (for now) and anything else is not exported.
This will evolve over time, or perhaps be replaced.
Types ¶
type PrometheusMetricsReflectRooter ¶
type PrometheusMetricsReflectRooter interface { expvar.Var // PrometheusMetricsReflectRoot returns the struct or struct pointer to walk. PrometheusMetricsReflectRoot() any }
PrometheusMetricsReflectRooter is an optional interface that expvar.Var implementations can implement to indicate that they should be walked recursively with reflect to find sets of fields to export.
Click to show internal directories.
Click to hide internal directories.