Use client generator to generate all k8s clients and add respective client-go metrics (#2668)
* Define client generator to generate all k8s clients * Increase QPS and burst values * Capture client-go metrics * Support for controller runtime metrics Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import (
|
||||
"github.com/fission/fission/pkg/crd"
|
||||
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
||||
"github.com/fission/fission/pkg/utils"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type ArchivePruner struct {
|
||||
@@ -39,14 +40,15 @@ type ArchivePruner struct {
|
||||
const defaultPruneInterval int = 60 // in minutes
|
||||
|
||||
func MakeArchivePruner(logger *zap.Logger, stowClient *StowClient, pruneInterval time.Duration) (*ArchivePruner, error) {
|
||||
crdClient, _, _, _, err := crd.MakeFissionClient()
|
||||
clientGen := crd.NewClientGenerator()
|
||||
fissionClient, err := clientGen.GetFissionClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrap(err, "failed to get fission client")
|
||||
}
|
||||
|
||||
return &ArchivePruner{
|
||||
logger: logger.Named("archive_pruner"),
|
||||
crdClient: crdClient,
|
||||
crdClient: fissionClient,
|
||||
archiveChan: make(chan string),
|
||||
stowClient: stowClient,
|
||||
pruneInterval: pruneInterval,
|
||||
|
||||
@@ -2,19 +2,20 @@ package storagesvc
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
|
||||
"github.com/fission/fission/pkg/utils/metrics"
|
||||
)
|
||||
|
||||
var (
|
||||
functionLabels = []string{}
|
||||
totalArchives = promauto.NewGaugeVec(
|
||||
totalArchives = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "fission_archives",
|
||||
Help: "Number of archives stored",
|
||||
},
|
||||
functionLabels,
|
||||
)
|
||||
totalMemoryUsage = promauto.NewGaugeVec(
|
||||
totalMemoryUsage = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "fission_archive_memory_bytes",
|
||||
Help: "Amount of memory consumed by archives",
|
||||
@@ -22,3 +23,9 @@ var (
|
||||
functionLabels,
|
||||
)
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry := metrics.Registry
|
||||
registry.MustRegister(totalArchives)
|
||||
registry.MustRegister(totalMemoryUsage)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user