Skip to content

Commit c86a2d6

Browse files
authored
Merge pull request kubernetes#126952 from aroradaman/proxy-nfacct-metric-cleanup
proxy/metrics: refactor nfacct metrics
2 parents ad59e46 + 6c5dac8 commit c86a2d6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/proxy/metrics/metrics.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ var (
147147
"kubeproxy_iptables_ct_state_invalid_dropped_packets_total",
148148
"packets dropped by iptables to work around conntrack problems",
149149
nil, nil, metrics.ALPHA, "")
150-
IPTablesCTStateInvalidDroppedNFAcctCounter = "ct_state_invalid_dropped_pkts"
151-
iptablesCTStateInvalidDroppedMetricCollector = newNFAcctMetricCollector(IPTablesCTStateInvalidDroppedNFAcctCounter, iptablesCTStateInvalidDroppedPacketsDescription)
150+
IPTablesCTStateInvalidDroppedNFAcctCounter = "ct_state_invalid_dropped_pkts"
152151

153152
// IPTablesRestoreFailuresTotal is the number of iptables restore failures that the proxy has
154153
// seen.
@@ -273,8 +272,7 @@ var (
273272
"kubeproxy_iptables_localhost_nodeports_accepted_packets_total",
274273
"Number of packets accepted on nodeports of loopback interface",
275274
nil, nil, metrics.ALPHA, "")
276-
LocalhostNodePortAcceptedNFAcctCounter = "localhost_nps_accepted_pkts"
277-
localhostNodePortsAcceptedMetricsCollector = newNFAcctMetricCollector(LocalhostNodePortAcceptedNFAcctCounter, localhostNodePortsAcceptedPacketsDescription)
275+
LocalhostNodePortAcceptedNFAcctCounter = "localhost_nps_accepted_pkts"
278276
)
279277

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

300298
switch mode {
301299
case kubeproxyconfig.ProxyModeIPTables:
300+
iptablesCTStateInvalidDroppedMetricCollector := newNFAcctMetricCollector(IPTablesCTStateInvalidDroppedNFAcctCounter, iptablesCTStateInvalidDroppedPacketsDescription)
302301
if iptablesCTStateInvalidDroppedMetricCollector != nil {
303302
legacyregistry.CustomMustRegister(iptablesCTStateInvalidDroppedMetricCollector)
304303
}
304+
localhostNodePortsAcceptedMetricsCollector := newNFAcctMetricCollector(LocalhostNodePortAcceptedNFAcctCounter, localhostNodePortsAcceptedPacketsDescription)
305305
if localhostNodePortsAcceptedMetricsCollector != nil {
306306
legacyregistry.CustomMustRegister(localhostNodePortsAcceptedMetricsCollector)
307307
}

0 commit comments

Comments
 (0)