Merge pull request #3804 from weaveworks/npc-errors-metrics2

metric for NPC errors
This commit is contained in:
Bryan Boreham authored and GitHub committed 2020-05-23 20:43:55 +01:00
commit 1f920513de
2 files changed
+15 -1

No files matched your search

+9
View File
@@ -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())
+6 -1
View File
@@ -34,7 +34,12 @@ var (
bridgePortName string
)
func handleError(err error) { common.CheckError(err) }
func handleError(err error) {
if err != nil {
metrics.PolicyEnforcementErrors.Inc()
common.Log.Error(err)
}
}
func handleFatal(err error) { common.CheckFatal(err) }