Documentation
¶
Index ¶
- type Callbacks
- type Conn
- type ConnType
- type Direction
- type Listener
- type PacketConn
- type Telemetry
- func (t *Telemetry) AddConnection(n string, c ConnType)
- func (t *Telemetry) Close() error
- func (t *Telemetry) Ctx() context.Context
- func (t *Telemetry) IncrementBytes(n string, c ConnType, d Direction, count uint64)
- func (t *Telemetry) IncrementPackets(n string, c ConnType, d Direction, count uint64)
- func (t *Telemetry) SubConnection(n string, c ConnType)
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
Conn is a net.Conn that knows how to report to Prometheus.
type ConnType ¶ added in v0.11.3
type ConnType int
ConnType species whether a conn stat was collected at a listener or a cluster.
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.
type Listener ¶ added in v0.11.3
Listener is a net.Listener that knows how to report to Prometheus.
func NewListener ¶ added in v0.11.3
NewListener creates a net.Listener that knows its name and type.
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.
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 (*Telemetry) AddConnection ¶ added in v1.1.0
func (*Telemetry) Close ¶ added in v1.1.0
Close cleanly shuts down the meter provider and blocks until the shutdown cycle is finished or a timout expires.