Add metric fission_mqt_message_lag for kafka mqt connector (#2544)

These changes have specifically been made for Kafka connector. This will expose a new metric named `fission_mqt_message_lag`, which will show a number of messages lag per topic and partition.

We can use this metric in the auto-scaling of the pod for the new deploy type executor function. While creating a new deploy function we need to add hpa metrics of external type inside the function definition.
This commit is contained in:
Shubham Bansal
2022-09-15 14:45:51 +05:30
committed by GitHub
parent 12d323e32f
commit dc4c6e20e3
2 changed files with 25 additions and 1 deletions
+11
View File
@@ -37,6 +37,13 @@ var (
},
labels,
)
messageLagCount = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Name: "fission_mqt_message_lag",
Help: "Total number of messages lag per topic and partition",
},
[]string{"trigger_name", "trigger_namespace", "topic", "partition"},
)
)
func IncreaseSubscriptionCount() {
@@ -50,3 +57,7 @@ func DecreaseSubscriptionCount() {
func IncreaseMessageCount(trigname, trignamespace string) {
messageCount.WithLabelValues(trigname, trignamespace).Inc()
}
func SetMessageLagCount(trigname, trignamespace, topic, partition string, lag int64) {
messageLagCount.WithLabelValues(trigname, trignamespace, topic, partition).Set(float64(lag))
}