@@ -466,7 +466,7 @@ func CleanupLeftovers(ctx context.Context, ipt utiliptables.Interface) (encounte
466
466
err = ipt .Restore (utiliptables .TableNAT , natLines , utiliptables .NoFlushTables , utiliptables .RestoreCounters )
467
467
if err != nil {
468
468
logger .Error (err , "Failed to execute iptables-restore" , "table" , utiliptables .TableNAT )
469
- metrics .IPTablesRestoreFailuresTotal .Inc ()
469
+ metrics .IPTablesRestoreFailuresTotal .WithLabelValues ( string ( ipt . Protocol ())). Inc ()
470
470
encounteredError = true
471
471
}
472
472
}
@@ -493,7 +493,7 @@ func CleanupLeftovers(ctx context.Context, ipt utiliptables.Interface) (encounte
493
493
// Write it.
494
494
if err := ipt .Restore (utiliptables .TableFilter , filterLines , utiliptables .NoFlushTables , utiliptables .RestoreCounters ); err != nil {
495
495
logger .Error (err , "Failed to execute iptables-restore" , "table" , utiliptables .TableFilter )
496
- metrics .IPTablesRestoreFailuresTotal .Inc ()
496
+ metrics .IPTablesRestoreFailuresTotal .WithLabelValues ( string ( ipt . Protocol ())). Inc ()
497
497
encounteredError = true
498
498
}
499
499
}
@@ -527,7 +527,7 @@ func (proxier *Proxier) Sync() {
527
527
if proxier .healthzServer != nil {
528
528
proxier .healthzServer .QueuedUpdate (proxier .ipFamily )
529
529
}
530
- metrics .SyncProxyRulesLastQueuedTimestamp .SetToCurrentTime ()
530
+ metrics .SyncProxyRulesLastQueuedTimestamp .WithLabelValues ( string ( proxier . ipFamily )). SetToCurrentTime ()
531
531
proxier .syncRunner .Run ()
532
532
}
533
533
@@ -539,7 +539,7 @@ func (proxier *Proxier) SyncLoop() {
539
539
}
540
540
541
541
// synthesize "last change queued" time as the informers are syncing.
542
- metrics .SyncProxyRulesLastQueuedTimestamp .SetToCurrentTime ()
542
+ metrics .SyncProxyRulesLastQueuedTimestamp .WithLabelValues ( string ( proxier . ipFamily )). SetToCurrentTime ()
543
543
proxier .syncRunner .Loop (wait .NeverStop )
544
544
}
545
545
@@ -813,11 +813,11 @@ func (proxier *Proxier) syncProxyRules() {
813
813
// Keep track of how long syncs take.
814
814
start := time .Now ()
815
815
defer func () {
816
- metrics .SyncProxyRulesLatency .Observe (metrics .SinceInSeconds (start ))
816
+ metrics .SyncProxyRulesLatency .WithLabelValues ( string ( proxier . ipFamily )). Observe (metrics .SinceInSeconds (start ))
817
817
if tryPartialSync {
818
- metrics .SyncPartialProxyRulesLatency .Observe (metrics .SinceInSeconds (start ))
818
+ metrics .SyncPartialProxyRulesLatency .WithLabelValues ( string ( proxier . ipFamily )). Observe (metrics .SinceInSeconds (start ))
819
819
} else {
820
- metrics .SyncFullProxyRulesLatency .Observe (metrics .SinceInSeconds (start ))
820
+ metrics .SyncFullProxyRulesLatency .WithLabelValues ( string ( proxier . ipFamily )). Observe (metrics .SinceInSeconds (start ))
821
821
}
822
822
proxier .logger .V (2 ).Info ("SyncProxyRules complete" , "elapsed" , time .Since (start ))
823
823
}()
@@ -833,7 +833,7 @@ func (proxier *Proxier) syncProxyRules() {
833
833
proxier .logger .Info ("Sync failed" , "retryingTime" , proxier .syncPeriod )
834
834
proxier .syncRunner .RetryAfter (proxier .syncPeriod )
835
835
if tryPartialSync {
836
- metrics .IPTablesPartialRestoreFailuresTotal .Inc ()
836
+ metrics .IPTablesPartialRestoreFailuresTotal .WithLabelValues ( string ( proxier . ipFamily )). Inc ()
837
837
}
838
838
// proxier.serviceChanges and proxier.endpointChanges have already
839
839
// been flushed, so we've lost the state needed to be able to do
@@ -1528,10 +1528,10 @@ func (proxier *Proxier) syncProxyRules() {
1528
1528
"-j" , "ACCEPT" ,
1529
1529
)
1530
1530
1531
- metrics .IPTablesRulesTotal .WithLabelValues (string (utiliptables .TableFilter )).Set (float64 (proxier .filterRules .Lines ()))
1532
- metrics .IPTablesRulesLastSync .WithLabelValues (string (utiliptables .TableFilter )).Set (float64 (proxier .filterRules .Lines ()))
1533
- metrics .IPTablesRulesTotal .WithLabelValues (string (utiliptables .TableNAT )).Set (float64 (proxier .natRules .Lines () + skippedNatRules .Lines () - deletedChains ))
1534
- metrics .IPTablesRulesLastSync .WithLabelValues (string (utiliptables .TableNAT )).Set (float64 (proxier .natRules .Lines () - deletedChains ))
1531
+ metrics .IPTablesRulesTotal .WithLabelValues (string (utiliptables .TableFilter ), string ( proxier . ipFamily ) ).Set (float64 (proxier .filterRules .Lines ()))
1532
+ metrics .IPTablesRulesLastSync .WithLabelValues (string (utiliptables .TableFilter ), string ( proxier . ipFamily ) ).Set (float64 (proxier .filterRules .Lines ()))
1533
+ metrics .IPTablesRulesTotal .WithLabelValues (string (utiliptables .TableNAT ), string ( proxier . ipFamily ) ).Set (float64 (proxier .natRules .Lines () + skippedNatRules .Lines () - deletedChains ))
1534
+ metrics .IPTablesRulesLastSync .WithLabelValues (string (utiliptables .TableNAT ), string ( proxier . ipFamily ) ).Set (float64 (proxier .natRules .Lines () - deletedChains ))
1535
1535
1536
1536
// Sync rules.
1537
1537
proxier .iptablesData .Reset ()
@@ -1563,7 +1563,7 @@ func (proxier *Proxier) syncProxyRules() {
1563
1563
} else {
1564
1564
proxier .logger .Error (err , "Failed to execute iptables-restore" )
1565
1565
}
1566
- metrics .IPTablesRestoreFailuresTotal .Inc ()
1566
+ metrics .IPTablesRestoreFailuresTotal .WithLabelValues ( string ( proxier . ipFamily )). Inc ()
1567
1567
return
1568
1568
}
1569
1569
success = true
@@ -1572,17 +1572,17 @@ func (proxier *Proxier) syncProxyRules() {
1572
1572
for name , lastChangeTriggerTimes := range endpointUpdateResult .LastChangeTriggerTimes {
1573
1573
for _ , lastChangeTriggerTime := range lastChangeTriggerTimes {
1574
1574
latency := metrics .SinceInSeconds (lastChangeTriggerTime )
1575
- metrics .NetworkProgrammingLatency .Observe (latency )
1575
+ metrics .NetworkProgrammingLatency .WithLabelValues ( string ( proxier . ipFamily )). Observe (latency )
1576
1576
proxier .logger .V (4 ).Info ("Network programming" , "endpoint" , klog .KRef (name .Namespace , name .Name ), "elapsed" , latency )
1577
1577
}
1578
1578
}
1579
1579
1580
- metrics .SyncProxyRulesNoLocalEndpointsTotal .WithLabelValues ("internal" ).Set (float64 (serviceNoLocalEndpointsTotalInternal ))
1581
- metrics .SyncProxyRulesNoLocalEndpointsTotal .WithLabelValues ("external" ).Set (float64 (serviceNoLocalEndpointsTotalExternal ))
1580
+ metrics .SyncProxyRulesNoLocalEndpointsTotal .WithLabelValues ("internal" , string ( proxier . ipFamily ) ).Set (float64 (serviceNoLocalEndpointsTotalInternal ))
1581
+ metrics .SyncProxyRulesNoLocalEndpointsTotal .WithLabelValues ("external" , string ( proxier . ipFamily ) ).Set (float64 (serviceNoLocalEndpointsTotalExternal ))
1582
1582
if proxier .healthzServer != nil {
1583
1583
proxier .healthzServer .Updated (proxier .ipFamily )
1584
1584
}
1585
- metrics .SyncProxyRulesLastTimestamp .SetToCurrentTime ()
1585
+ metrics .SyncProxyRulesLastTimestamp .WithLabelValues ( string ( proxier . ipFamily )). SetToCurrentTime ()
1586
1586
1587
1587
// Update service healthchecks. The endpoints list might include services that are
1588
1588
// not "OnlyLocal", but the services list will not, and the serviceHealthServer
0 commit comments