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:
Sanket Sudake
2022-12-13 14:19:36 +05:30
committed by GitHub
parent 31f4f8c57e
commit 5fae765323
26 changed files with 252 additions and 137 deletions
+12 -4
View File
@@ -18,26 +18,27 @@ package mqtrigger
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/fission/fission/pkg/utils/metrics"
)
var (
labels = []string{"trigger_name", "trigger_namespace"}
subscriptionCount = promauto.NewGaugeVec(
subscriptionCount = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "fission_mqt_subscriptions",
Help: "Total number of subscriptions to mq currently",
},
[]string{},
)
messageCount = promauto.NewCounterVec(
messageCount = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "fission_mqt_messages_processed_total",
Help: "Total number of messages processed",
},
labels,
)
messageLagCount = promauto.NewGaugeVec(
messageLagCount = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "fission_mqt_message_lag",
Help: "Total number of messages lag per topic and partition",
@@ -61,3 +62,10 @@ func IncreaseMessageCount(trigname, trignamespace string) {
func SetMessageLagCount(trigname, trignamespace, topic, partition string, lag int64) {
messageLagCount.WithLabelValues(trigname, trignamespace, topic, partition).Set(float64(lag))
}
func init() {
registry := metrics.Registry
registry.MustRegister(subscriptionCount)
registry.MustRegister(messageCount)
registry.MustRegister(messageLagCount)
}