metrics

package
v0.83.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

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

Metrics collects OpenTelemetry metrics for the proxy.

func New

func New(ctx context.Context, meter metric.Meter) (*Metrics, error)

New creates a Metrics instance using the given OpenTelemetry meter.

func (*Metrics) AddMapping

func (m *Metrics) AddMapping(mapping proxy.Mapping)

AddMapping records that a domain mapping was added.

func (*Metrics) L4ServiceAdded added in v0.67.0

func (m *Metrics) L4ServiceAdded(mode types.ServiceMode)

L4ServiceAdded increments the L4 service gauge for the given mode.

func (*Metrics) L4ServiceRemoved added in v0.67.0

func (m *Metrics) L4ServiceRemoved(mode types.ServiceMode)

L4ServiceRemoved decrements the L4 service gauge for the given mode.

func (*Metrics) Meter added in v0.74.0

func (m *Metrics) Meter() metric.Meter

Meter returns the OpenTelemetry meter the bundle was built with, so other subsystems (e.g. the middleware manager) register instruments on the same meter.

func (*Metrics) Middleware

func (m *Metrics) Middleware(next http.Handler) http.Handler

Middleware wraps an HTTP handler with request metrics.

func (*Metrics) RecordAddPeerDuration added in v0.71.3

func (m *Metrics) RecordAddPeerDuration(d time.Duration, err error)

RecordAddPeerDuration records the time to create a new peer for an account.

func (*Metrics) RecordCertificateIssuance added in v0.66.3

func (m *Metrics) RecordCertificateIssuance(duration time.Duration)

RecordCertificateIssuance records the duration of a certificate issuance.

func (*Metrics) RecordSnapshotBatchDuration added in v0.71.3

func (m *Metrics) RecordSnapshotBatchDuration(d time.Duration)

RecordSnapshotBatchDuration records the time to process one mapping batch during initial sync.

func (*Metrics) RecordSnapshotSyncDuration added in v0.71.3

func (m *Metrics) RecordSnapshotSyncDuration(d time.Duration)

RecordSnapshotSyncDuration records the total time from connect to sync-complete.

func (*Metrics) RegisterClientObserver added in v0.80.0

func (m *Metrics) RegisterClientObserver(clientCount func() int) error

RegisterClientObserver reports the number of embedded clients as a gauge. clientCount runs on every collection cycle, so it must stay cheap.

func (*Metrics) RemoveMapping

func (m *Metrics) RemoveMapping(mapping proxy.Mapping)

RemoveMapping records that a domain mapping was removed.

func (*Metrics) RoundTripper

func (m *Metrics) RoundTripper(next http.RoundTripper) http.RoundTripper

RoundTripper wraps an http.RoundTripper with backend duration metrics.

func (*Metrics) TCPRelayDialError added in v0.67.0

func (m *Metrics) TCPRelayDialError(accountID types.AccountID)

TCPRelayDialError records a dial failure for a TCP relay.

func (*Metrics) TCPRelayEnded added in v0.67.0

func (m *Metrics) TCPRelayEnded(accountID types.AccountID, duration time.Duration, srcToDst, dstToSrc int64)

TCPRelayEnded records a TCP relay connection ending and accumulates bytes and duration.

func (*Metrics) TCPRelayRejected added in v0.67.0

func (m *Metrics) TCPRelayRejected(accountID types.AccountID)

TCPRelayRejected records a rejected TCP relay (semaphore full).

func (*Metrics) TCPRelayStarted added in v0.67.0

func (m *Metrics) TCPRelayStarted(accountID types.AccountID)

TCPRelayStarted records a new TCP relay connection starting.

func (*Metrics) UDPPacketRelayed added in v0.67.0

func (m *Metrics) UDPPacketRelayed(direction types.RelayDirection, bytes int)

UDPPacketRelayed records a packet relayed in the given direction with its size in bytes.

func (*Metrics) UDPSessionDialError added in v0.67.0

func (m *Metrics) UDPSessionDialError(accountID types.AccountID)

UDPSessionDialError records a dial failure for a UDP session.

func (*Metrics) UDPSessionEnded added in v0.67.0

func (m *Metrics) UDPSessionEnded(accountID types.AccountID)

UDPSessionEnded records a UDP session ending.

func (*Metrics) UDPSessionRejected added in v0.67.0

func (m *Metrics) UDPSessionRejected(accountID types.AccountID)

UDPSessionRejected records a rejected UDP session (limit or rate limited).

func (*Metrics) UDPSessionStarted added in v0.67.0

func (m *Metrics) UDPSessionStarted(accountID types.AccountID)

UDPSessionStarted records a new UDP session starting.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL