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:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user