Skip to content

Commit

Permalink
proxy/metrics: refactor nfacct metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Daman Arora <[email protected]>
  • Loading branch information
aroradaman committed Aug 27, 2024
1 parent 09596a5 commit 6c5dac8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/proxy/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ var (
"kubeproxy_iptables_ct_state_invalid_dropped_packets_total",
"packets dropped by iptables to work around conntrack problems",
nil, nil, metrics.ALPHA, "")
IPTablesCTStateInvalidDroppedNFAcctCounter = "ct_state_invalid_dropped_pkts"
iptablesCTStateInvalidDroppedMetricCollector = newNFAcctMetricCollector(IPTablesCTStateInvalidDroppedNFAcctCounter, iptablesCTStateInvalidDroppedPacketsDescription)
IPTablesCTStateInvalidDroppedNFAcctCounter = "ct_state_invalid_dropped_pkts"

// IPTablesRestoreFailuresTotal is the number of iptables restore failures that the proxy has
// seen.
Expand Down Expand Up @@ -273,8 +272,7 @@ var (
"kubeproxy_iptables_localhost_nodeports_accepted_packets_total",
"Number of packets accepted on nodeports of loopback interface",
nil, nil, metrics.ALPHA, "")
LocalhostNodePortAcceptedNFAcctCounter = "localhost_nps_accepted_pkts"
localhostNodePortsAcceptedMetricsCollector = newNFAcctMetricCollector(LocalhostNodePortAcceptedNFAcctCounter, localhostNodePortsAcceptedPacketsDescription)
LocalhostNodePortAcceptedNFAcctCounter = "localhost_nps_accepted_pkts"
)

var registerMetricsOnce sync.Once
Expand All @@ -299,9 +297,11 @@ func RegisterMetrics(mode kubeproxyconfig.ProxyMode) {

switch mode {
case kubeproxyconfig.ProxyModeIPTables:
iptablesCTStateInvalidDroppedMetricCollector := newNFAcctMetricCollector(IPTablesCTStateInvalidDroppedNFAcctCounter, iptablesCTStateInvalidDroppedPacketsDescription)
if iptablesCTStateInvalidDroppedMetricCollector != nil {
legacyregistry.CustomMustRegister(iptablesCTStateInvalidDroppedMetricCollector)
}
localhostNodePortsAcceptedMetricsCollector := newNFAcctMetricCollector(LocalhostNodePortAcceptedNFAcctCounter, localhostNodePortsAcceptedPacketsDescription)
if localhostNodePortsAcceptedMetricsCollector != nil {
legacyregistry.CustomMustRegister(localhostNodePortsAcceptedMetricsCollector)
}
Expand Down

0 comments on commit 6c5dac8

Please sign in to comment.