Documentation ¶
Overview ¶
Package usermetric provides a container and handler for 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 Registry
- func (r *Registry) DroppedPacketsInbound() *metrics.MultiLabelMap[DropLabels]
- func (r *Registry) DroppedPacketsOutbound() *metrics.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 ¶
func NewMultiLabelMapWithRegistry ¶
func NewMultiLabelMapWithRegistry[T comparable](m *Registry, name string, promType, helpText string) *metrics.MultiLabelMap[T]
NewMultiLabelMapWithRegistry creates and register a new MultiLabelMap[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 duplicate metrics name. It is the caller's responsibility to ensure that the name is unique.
Types ¶
type DropLabels ¶
type DropLabels struct {
Reason DropReason
}
DropLabels contains common label(s) for dropped packet counters.
type DropReason ¶
type DropReason string
DropReason is the reason why a packet was dropped.
const ( // ReasonACL means that the packet was not permitted by ACL. ReasonACL DropReason = "acl" // ReasonError means that the packet was dropped because of an error. ReasonError DropReason = "error" )
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge is a gauge metric with no labels.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics contains user-facing metrics that are used by multiple packages.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks user-facing metrics of various Tailscale subsystems.
func (*Registry) DroppedPacketsInbound ¶
func (r *Registry) DroppedPacketsInbound() *metrics.MultiLabelMap[DropLabels]
DroppedPacketsInbound returns the inbound dropped packet metric.
func (*Registry) DroppedPacketsOutbound ¶
func (r *Registry) DroppedPacketsOutbound() *metrics.MultiLabelMap[DropLabels]
DroppedPacketsOutbound returns the outbound dropped packet metric, creating it if necessary.
func (*Registry) Handler ¶
func (r *Registry) Handler(w http.ResponseWriter, req *http.Request)
Handler returns a varz.Handler that serves the userfacing expvar contained in this package.
func (*Registry) MetricNames ¶
Metrics returns the name of all the metrics in the registry.