usermetric
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package usermetric provides a container and handlerfor user-facing metrics.
Index¶
- func NewMultiLabelMapWithRegistry[T comparable](m *Registry, name string, promType, helpText string) *metrics.MultiLabelMap[T]
- type DropLabels
- type DropReason
- type Gauge
- type Metrics
- type MultiLabelMap
- type Registry
- func (r *Registry) DroppedPacketsInbound() *MultiLabelMap[DropLabels]
- func (r *Registry) DroppedPacketsOutbound() *MultiLabelMap[DropLabels]
- func (r *Registry) Handler(w http.ResponseWriter, req *http.Request)
- func (r *Registry) MetricNames() []string
- func (r *Registry) NewGauge(name, help string) *Gauge
- func (r *Registry) String() string
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcNewMultiLabelMapWithRegistry¶added 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¶
typeDropLabels¶added inv1.78.0
type DropLabels struct {ReasonDropReason}DropLabels contains common label(s) for dropped packet counters.
typeDropReason¶added 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.
typeMetrics¶added inv1.78.0
type Metrics struct {// contains filtered or unexported fields}Metrics contains user-facing metrics that are used by multiple packages.
typeMultiLabelMap¶added 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.
typeRegistry¶added inv1.76.0
type Registry struct {// contains filtered or unexported fields}Registry tracks user-facing metrics of various Tailscale subsystems.
func (*Registry)DroppedPacketsInbound¶added inv1.78.0
func (r *Registry) DroppedPacketsInbound() *MultiLabelMap[DropLabels]
DroppedPacketsInbound returns the inbound dropped packet metric.
func (*Registry)DroppedPacketsOutbound¶added inv1.78.0
func (r *Registry) DroppedPacketsOutbound() *MultiLabelMap[DropLabels]
DroppedPacketsOutbound returns the outbound dropped packet metric, creating itif necessary.
func (*Registry)Handler¶added 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)MetricNames¶added inv1.78.0
Metrics returns the name of all the metrics in the registry.