Merge pull request #3804 from weaveworks/npc-errors-metrics2
metric for NPC errors
This commit is contained in:
2 files changed
+15
-1
No files matched your search
@@ -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())
|
||||
|
||||
|
||||
@@ -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) }
|
||||
|
||||
|
||||
Reference in new issue
Block a user