Movatterモバイル変換


[0]ホーム

URL:


usermetric

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:10Imported by:7

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package usermetric provides a container and handlerfor user-facing metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcNewMultiLabelMapWithRegistryadded inv1.76.0

func NewMultiLabelMapWithRegistry[Tcomparable](m *Registry, namestring, promType, helpTextstring) *metrics.MultiLabelMap[T]

NewMultiLabelMapWithRegistry creates and register a newMultiLabelMap[T] variable with the given name and returns it.The variable is registered with the userfacing metrics package.

Note that usermetric are not protected against duplicatemetrics name. It is the caller's responsibility to ensure thatthe name is unique.

Types

typeDropLabelsadded inv1.78.0

type DropLabels struct {ReasonDropReason}

DropLabels contains common label(s) for dropped packet counters.

typeDropReasonadded inv1.78.0

type DropReasonstring

DropReason is the reason why a packet was dropped.

const (// ReasonACL means that the packet was not permitted by ACL.ReasonACLDropReason = "acl"// ReasonMulticast means that the packet was dropped because it was a multicast packet.ReasonMulticastDropReason = "multicast"// ReasonLinkLocalUnicast means that the packet was dropped because it was a link-local unicast packet.ReasonLinkLocalUnicastDropReason = "link_local_unicast"// ReasonTooShort means that the packet was dropped because it was a bad packet,// this could be due to a short packet.ReasonTooShortDropReason = "too_short"// ReasonFragment means that the packet was dropped because it was an IP fragment.ReasonFragmentDropReason = "fragment"// ReasonUnknownProtocol means that the packet was dropped because it was an unknown protocol.ReasonUnknownProtocolDropReason = "unknown_protocol"// ReasonError means that the packet was dropped because of an error.ReasonErrorDropReason = "error")

typeGauge

type Gauge struct {// contains filtered or unexported fields}

Gauge is a gauge metric with no labels.

func (*Gauge)Set

func (g *Gauge) Set(vfloat64)

Set sets the gauge to the given value.

func (*Gauge)String

func (g *Gauge) String()string

String returns the string of the underlying expvar.Float.This satisfies the expvar.Var interface.

func (*Gauge)WritePrometheus

func (g *Gauge) WritePrometheus(wio.Writer, namestring)

WritePrometheus writes the gauge metric in Prometheus format to the given writer.This satisfies the varz.PrometheusWriter interface.

typeMetricsadded inv1.78.0

type Metrics struct {// contains filtered or unexported fields}

Metrics contains user-facing metrics that are used by multiple packages.

typeMultiLabelMapadded inv1.90.0

type MultiLabelMap[Tcomparable] =metrics.MultiLabelMap[T]

MultiLabelMap is an alias for metrics.MultiLabelMap in the common case,or an alias to a lighter type when usermetrics are omitted from the build.

typeRegistryadded inv1.76.0

type Registry struct {// contains filtered or unexported fields}

Registry tracks user-facing metrics of various Tailscale subsystems.

func (*Registry)DroppedPacketsInboundadded inv1.78.0

func (r *Registry) DroppedPacketsInbound() *MultiLabelMap[DropLabels]

DroppedPacketsInbound returns the inbound dropped packet metric.

func (*Registry)DroppedPacketsOutboundadded inv1.78.0

func (r *Registry) DroppedPacketsOutbound() *MultiLabelMap[DropLabels]

DroppedPacketsOutbound returns the outbound dropped packet metric, creating itif necessary.

func (*Registry)Handleradded inv1.76.0

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

Handler returns a varz.Handler that serves the userfacing expvar containedin this package.

func (*Registry)MetricNamesadded inv1.78.0

func (r *Registry) MetricNames() []string

Metrics returns the name of all the metrics in the registry.

func (*Registry)NewGaugeadded inv1.76.0

func (r *Registry) NewGauge(name, helpstring) *Gauge

NewGauge creates and register a new gauge metric with the given name and help text.

func (*Registry)Stringadded inv1.76.0

func (r *Registry) String()string

String returns the string representation of all the metrics and theirvalues in the registry. It is useful for debugging.

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