telemetry

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks added in v1.1.0

type Callbacks struct {
	// GetAllocationCount should map to the total allocation counter of the server.
	GetAllocationCount func() int64
}

Callbacks lets the caller to define various callbacks for reporting active metrics from an object that cannot be reached from this subpackage. This interface allows to easily add new metric reporters.

type Conn added in v0.11.3

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

Conn is a net.Conn that knows how to report to Prometheus.

func NewConn added in v0.11.3

func NewConn(c net.Conn, n string, t ConnType, tm *Telemetry) *Conn

NewConn allocates a stats conn that knows its name and type.

func (*Conn) Close added in v0.11.3

func (c *Conn) Close() error

Close closes the Conn.

func (*Conn) Read added in v0.11.3

func (c *Conn) Read(b []byte) (n int, err error)

Read reads from the Conn.

func (*Conn) Write added in v0.11.3

func (c *Conn) Write(b []byte) (n int, err error)

Write writes to the Conn.

type ConnType added in v0.11.3

type ConnType int

ConnType species whether a conn stat was collected at a listener or a cluster.

const (
	ListenerType ConnType = iota + 1
	ClusterType
)

func (ConnType) String added in v0.11.3

func (c ConnType) String() string

String returns a string representation for a ConnType.

type Direction added in v0.11.3

type Direction int

Direction species whether a conn stat applies in the sender or a receiving direction from the standpoint of STUNner.

const (
	Incoming Direction = iota + 1
	Outgoing
)

func (Direction) String added in v0.11.3

func (d Direction) String() string

String returns a string representation for a Direction.

type Listener added in v0.11.3

type Listener struct {
	net.Listener
	// contains filtered or unexported fields
}

Listener is a net.Listener that knows how to report to Prometheus.

func NewListener added in v0.11.3

func NewListener(l net.Listener, n string, t ConnType, tm *Telemetry) *Listener

NewListener creates a net.Listener that knows its name and type.

func (*Listener) Accept added in v0.11.3

func (l *Listener) Accept() (net.Conn, error)

Accept accepts a new connection on a Listener.

type PacketConn added in v0.11.3

type PacketConn struct {
	net.PacketConn
	// contains filtered or unexported fields
}

PacketConn is a net.PacketConn that knows how to report to Prometheus.

func NewPacketConn added in v0.11.3

func NewPacketConn(c net.PacketConn, n string, t ConnType, tm *Telemetry) *PacketConn

NewPacketConn decorates a PacketConnn with metric reporting.

func (*PacketConn) Close added in v0.11.3

func (c *PacketConn) Close() error

ReadFrom reads from the PacketConn. WriteTo writes to the PacketConn. Close closes the PacketConn.

func (*PacketConn) ReadFrom added in v0.11.3

func (c *PacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

ReadFrom reads from the PacketConn.

func (*PacketConn) WriteTo added in v0.11.3

func (c *PacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

WriteTo writes to the PacketConn.

type Telemetry added in v1.1.0

type Telemetry struct {
	sdkmetric.Reader

	// Metrics instruments
	ListenerPacketsCounter metric.Int64Counter
	ListenerBytesCounter   metric.Int64Counter
	ListenerConnsCounter   metric.Int64Counter
	ListenerConnsGauge     metric.Int64UpDownCounter
	ClusterPacketsCounter  metric.Int64Counter
	ClusterBytesCounter    metric.Int64Counter
	AllocationsGauge       metric.Int64ObservableGauge
	// contains filtered or unexported fields
}

func New added in v1.1.0

func New(callbacks Callbacks, dryRun bool, log logging.LeveledLogger) (*Telemetry, error)

func (*Telemetry) AddConnection added in v1.1.0

func (t *Telemetry) AddConnection(n string, c ConnType)

func (*Telemetry) Close added in v1.1.0

func (t *Telemetry) Close() error

Close cleanly shuts down the meter provider and blocks until the shutdown cycle is finished or a timout expires.

func (*Telemetry) Ctx added in v1.1.0

func (t *Telemetry) Ctx() context.Context

func (*Telemetry) IncrementBytes added in v1.1.0

func (t *Telemetry) IncrementBytes(n string, c ConnType, d Direction, count uint64)

func (*Telemetry) IncrementPackets added in v1.1.0

func (t *Telemetry) IncrementPackets(n string, c ConnType, d Direction, count uint64)

func (*Telemetry) SubConnection added in v1.1.0

func (t *Telemetry) SubConnection(n string, c ConnType)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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