Skip to content

Commit 0bee69f

Browse files
authored
Merge pull request #17239 from dcbw/vnid-not-found-metrics
sdn: add metric for "failed to find netid for namespace: XXXX in vnid map" errors
2 parents 8f7168a + 85de958 commit 0bee69f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/network/node/metrics.go

+11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const (
2727
PodSetupLatencyKey = "pod_setup_latency"
2828
PodTeardownErrorsKey = "pod_teardown_errors"
2929
PodTeardownLatencyKey = "pod_teardown_latency"
30+
VnidNotFoundErrorsKey = "vnid_not_found_errors"
3031
)
3132

3233
var (
@@ -95,6 +96,15 @@ var (
9596
[]string{"pod_namespace", "pod_name", "sandbox_id"},
9697
)
9798

99+
VnidNotFoundErrors = prometheus.NewCounter(
100+
prometheus.CounterOpts{
101+
Namespace: SDNNamespace,
102+
Subsystem: SDNSubsystem,
103+
Name: VnidNotFoundErrorsKey,
104+
Help: "Number of VNID-not-found errors",
105+
},
106+
)
107+
98108
// num stale OVS flows (flows that reference non-existent ports)
99109
// num vnids (in the master)
100110
// num netnamespaces (in the master)
@@ -115,6 +125,7 @@ func RegisterMetrics() {
115125
prometheus.MustRegister(PodSetupLatency)
116126
prometheus.MustRegister(PodTeardownErrors)
117127
prometheus.MustRegister(PodTeardownLatency)
128+
prometheus.MustRegister(VnidNotFoundErrors)
118129
})
119130
}
120131

pkg/network/node/vnids.go

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func (vmap *nodeVNIDMap) WaitAndGetVNID(name string) (uint32, error) {
106106
if err == nil {
107107
return id, nil
108108
} else {
109+
VnidNotFoundErrors.Inc()
109110
return 0, fmt.Errorf("failed to find netid for namespace: %s in vnid map", name)
110111
}
111112
}

0 commit comments

Comments
 (0)