Skip to content

Commit

Permalink
Merge pull request #126 from squeed/backport-sdn-metric
Browse files Browse the repository at this point in the history
UPSTREAM <90175>: pkg/proxy: add last-queued-timestamp metric
  • Loading branch information
danwinship committed May 6, 2020
2 parents d411faf + 6022863 commit 662762e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/proxy/iptables/proxier.go
Expand Up @@ -495,6 +495,7 @@ func (proxier *Proxier) probability(n int) string {
func (proxier *Proxier) Sync() {
if proxier.healthzServer != nil {
proxier.healthzServer.QueuedUpdate()
metrics.SyncProxyRulesLastQueuedTimestamp.SetToCurrentTime()
}
proxier.syncRunner.Run()
}
Expand Down
1 change: 1 addition & 0 deletions pkg/proxy/ipvs/proxier.go
Expand Up @@ -805,6 +805,7 @@ func CleanupLeftovers(ipvs utilipvs.Interface, ipt utiliptables.Interface, ipset
func (proxier *Proxier) Sync() {
if proxier.healthzServer != nil {
proxier.healthzServer.QueuedUpdate()
metrics.SyncProxyRulesLastQueuedTimestamp.SetToCurrentTime()
}
proxier.syncRunner.Run()
}
Expand Down
13 changes: 13 additions & 0 deletions pkg/proxy/metrics/metrics.go
Expand Up @@ -125,6 +125,18 @@ var (
StabilityLevel: metrics.ALPHA,
},
)

// SyncProxyRulesLastQueuedTimestamp is the last time a proxy sync was
// requested. If this is much larger than
// kubeproxy_sync_proxy_rules_last_timestamp_seconds, then something is hung.
SyncProxyRulesLastQueuedTimestamp = metrics.NewGauge(
&metrics.GaugeOpts{
Subsystem: kubeProxySubsystem,
Name: "sync_proxy_rules_last_queued_timestamp_seconds",
Help: "The last time a sync of proxy rules was queued",
StabilityLevel: metrics.ALPHA,
},
)
)

var registerMetricsOnce sync.Once
Expand All @@ -140,6 +152,7 @@ func RegisterMetrics() {
legacyregistry.MustRegister(ServiceChangesPending)
legacyregistry.MustRegister(ServiceChangesTotal)
legacyregistry.MustRegister(IptablesRestoreFailuresTotal)
legacyregistry.MustRegister(SyncProxyRulesLastQueuedTimestamp)
})
}

Expand Down
1 change: 1 addition & 0 deletions pkg/proxy/winkernel/proxier.go
Expand Up @@ -736,6 +736,7 @@ func getHnsNetworkInfo(hnsNetworkName string) (*hnsNetworkInfo, error) {
func (proxier *Proxier) Sync() {
if proxier.healthzServer != nil {
proxier.healthzServer.QueuedUpdate()
metrics.SyncProxyRulesLastQueuedTimestamp.SetToCurrentTime()
}
proxier.syncRunner.Run()
}
Expand Down

0 comments on commit 662762e

Please sign in to comment.