Skip to content

Commit

Permalink
Merge pull request k8snetworkplumbingwg#14 from aneeshkp/initialize-m…
Browse files Browse the repository at this point in the history
…etrics

Initialize metrics
  • Loading branch information
openshift-merge-robot authored Nov 1, 2019
2 parents d860126 + 1dfb78c commit 63614aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ reviewers:
- fepan
- s1061123
- jeremyeder
- aneeshkp
approvers:
- dougbtv
- dcbw
Expand All @@ -14,4 +15,4 @@ approvers:
- fepan
- s1061123
- jeremyeder

- aneeshkp
2 changes: 2 additions & 0 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func StartWatching() {
if err != nil {
glog.Fatalf("There was error accessing client set for net attach def %v", err)
}
//Initialize default metrics
localmetrics.InitMetrics()

informer := cache.NewSharedIndexInformer(
&cache.ListWatch{
Expand Down
8 changes: 7 additions & 1 deletion pkg/localmetrics/localmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
)

var log = logf.Log.WithName("netdefattachment")
var log = logf.Log.WithName("network-attachment-definition")
var (
netDefInstanceEnabledCount = 0.0
netDefInstanceSriovEnabledCount = 0.0
Expand Down Expand Up @@ -66,3 +66,9 @@ func SetNetDefAttachEnabledInstanceUp(tp string, val float64) {
NetDefAttachEnabledInstanceUp.With(prometheus.Labels{
"networks": tp}).Set(val)
}

//Initialize ... empty metrics
func InitMetrics() {
UpdateNetDefAttachInstanceMetrics("any", 0.0)
UpdateNetDefAttachInstanceMetrics("sriov", 0.0)
}

0 comments on commit 63614aa

Please sign in to comment.