Documentation ¶
Index ¶
Constants ¶
const (
TableName = "nat-stats"
)
Variables ¶
var Cell = cell.Module( "nat-stats", "Aggregates stats for NAT maps", metrics.Metric(newMetrics), cell.ProvidePrivate(newTables), cell.Provide( func(m Metrics) natMetrics { return m }, newStats, statedb.RWTable[NatMapStats].ToTable, ), cell.Config(Config{ NATMapStatInterval: 30 * time.Second, NatMapStatKStoredEntries: 32, }), cell.Invoke(func(_ *Stats) {}), )
Cell exports a module providing functionality for computing NAT map stats. This uses provided pkg/maps/nat.(Cell) maps to efficiently walk the nat map and compute the top-k most used connection tuples. In this context, a "connection tuple" refers to the 4-tuple:
{port, egressIP, remoteEndpointIP, remoteEndpointPort}
Which defines a distinct set of translated connections for which the source IP is the egress IP, who all share the same endpoint address. Egress source ports are allocated by the datapath and, in some cases, can be prone to exhaustion or allocation failures if the connection tuple already has many connections to the same endpoint.
The nat-stats module exposes this data as both prometheus metrics and via a exported statedb.Table[NatMapStats] for other modules to consume.
var ( Index = statedb.Index[NatMapStats, string]{ Name: "byTuple", FromObject: func(s NatMapStats) index.KeySet { return index.NewKeySet(s.Key()) }, FromKey: index.String, Unique: true, } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type NatMapStats ¶
type NatMapStats struct { Type string EgressIP string EndpointIP string RemotePort uint16 Proto string Count int Nth int }
NatMapStats is a nat-map table entry key/value. This contains a count of connection 3-tuple utilization.
func (NatMapStats) Key ¶
func (s NatMapStats) Key() index.Key
func (NatMapStats) TableHeader ¶
func (NatMapStats) TableHeader() []string
func (NatMapStats) TableRow ¶
func (s NatMapStats) TableRow() []string