Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
Add all controller metrics
Browse files Browse the repository at this point in the history
This commit adds metrics of HierConfig and all other object controllers.
It includes total reconciliations and peak concurrent reconciliations
and related api writes.

Tested on GKE cluster and the metrics can all be viewed in Stackdriver.
  • Loading branch information
yiqigao217 committed Feb 14, 2020
1 parent 2c22e8c commit fdba1c5
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 11 deletions.
7 changes: 6 additions & 1 deletion incubator/hnc/cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main
import (
"flag"
"os"
"time"

"contrib.go.opencensus.io/exporter/stackdriver"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -75,7 +76,11 @@ func main() {
// Exporters use Application Default Credentials to authenticate.
// See https://developers.google.com/identity/protocols/application-default-credentials
// for more details.
exporter, err := stackdriver.NewExporter(stackdriver.Options{})
exporter, err := stackdriver.NewExporter(stackdriver.Options{
// Stackdriver’s minimum stats reporting period must be >= 60 seconds.
// https://opencensus.io/exporters/supported-exporters/go/stackdriver/
ReportingInterval: 1 * time.Minute,
})
if err != nil {
setupLog.Error(err, "cannot create Stackdriver exporter")
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions incubator/hnc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/kubernetes-sigs/multi-tenancy/incubator/hnc
go 1.12

require (
contrib.go.opencensus.io/exporter/stackdriver v0.13.0
github.com/Azure/go-autorest/autorest v0.9.1 // indirect
github.com/Azure/go-autorest/autorest/adal v0.6.0 // indirect
github.com/emicklei/go-restful v2.10.0+incompatible // indirect
Expand All @@ -16,6 +17,7 @@ require (
github.com/onsi/gomega v1.7.0
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/spf13/cobra v0.0.5
go.opencensus.io v0.22.3
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
k8s.io/cli-runtime v0.0.0-20190314001948-2899ed30580f
Expand Down
Loading

0 comments on commit fdba1c5

Please sign in to comment.