Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPSTREAM <90175>: pkg/proxy: add last-queued-timestamp metric #126

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/proxy/iptables/proxier.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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