From 77fbb2c12b2c6a91992d259714e5d7c0c9d4356a Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Thu, 16 Apr 2020 13:13:52 +0530 Subject: [PATCH] introduce weavenpc_policy_enforcement_errors prometheus metric to track number of errors occured during enforcing network policies Fixes #3791 --- npc/metrics/metrics.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/npc/metrics/metrics.go b/npc/metrics/metrics.go index 5c6149b8..cad65531 100644 --- a/npc/metrics/metrics.go +++ b/npc/metrics/metrics.go @@ -22,6 +22,12 @@ var ( }, []string{"protocol", "dport"}, ) + PolicyEnforcementErrors = prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "weavenpc_policy_enforcement_errors", + Help: "Errors occured in enforcing the network policies.", + }, + ) ) func gatherMetrics() { @@ -95,6 +101,9 @@ func Start(addr string) error { if err := prometheus.Register(blockedConnections); err != nil { return err } + if err := prometheus.Register(PolicyEnforcementErrors); err != nil { + return err + } http.Handle("/metrics", promhttp.Handler())