Movatterモバイル変換


[0]ホーム

URL:


varz

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:22Imported by:8

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package varz contains code to export metrics in Prometheus format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcExpvarDoHandleradded inv1.74.0

func ExpvarDoHandler(expvarDoFunc func(f func(expvar.KeyValue))) func(http.ResponseWriter, *http.Request)

ExpvarDoHandler handler returns a Handler like above, but takes an optionalexpvar.Do func allow the usage of alternative containers of metrics, otherthan the global expvar.Map.

funcHandler

func Handler(whttp.ResponseWriter, r *http.Request)

Handler is an HTTP handler to write expvar values into theprometheus 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 withunderscores. So use underscores as your metric names.
  • an expvar named starting with "gauge_" or "counter_" is of thatPrometheus 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 elseis not exported.

This will evolve over time, or perhaps be replaced.

funcStaticStringVaradded inv1.78.0

func StaticStringVar(sstring)expvar.Var

StaticStringVar returns a new expvar.Var that always returns s.

funcUptime

func Uptime()time.Duration

funcWritePrometheusExpvar

func WritePrometheusExpvar(wio.Writer, kvexpvar.KeyValue)

WritePrometheusExpvar writes kv to w in Prometheus metrics format.

See VarzHandler for conventions. This is exported primarily forpeople to test their varz.

Types

typePrometheusMetricsReflectRooter

type PrometheusMetricsReflectRooter interface {expvar.Var// PrometheusMetricsReflectRoot returns the struct or struct pointer to walk.PrometheusMetricsReflectRoot()any}

PrometheusMetricsReflectRooter is an optional interface that expvar.Var implementationscan implement to indicate that they should be walked recursively with reflect to findsets of fields to export.

typePrometheusWriteradded inv1.64.0

type PrometheusWriter interface {WritePrometheus(wio.Writer, namestring)}

PrometheusWriter is the interface implemented by metrics that can writethemselves into Prometheus exposition format.

As of 2024-03-25, this is only *metrics.MultiLabelMap.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp