Add status code for twirp request latency prometheus metric (#4621)

* Add status code for twirp request latency prometheus metric

* Drop the twirp error codes as that adds a lot of coardinality
This commit is contained in:
Ninad Pundalik
2026-07-22 15:52:30 +05:30
committed by GitHub
parent 13e4aaec2b
commit afb9142c1e
2 changed files with 31 additions and 23 deletions
+3 -3
View File
@@ -90,7 +90,7 @@ func Init(nodeID string, nodeType livekit.NodeType) error {
ConstLabels: prometheus.Labels{"node_id": nodeID, "node_type": nodeType.String()},
Buckets: []float64{5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 30000, 60000},
},
[]string{"service", "method"},
[]string{"service", "method", "status"},
)
promSysPacketGauge = prometheus.NewGaugeVec(
@@ -305,6 +305,6 @@ func RecordTwirpRequestStatus(service string, method string, statusFamily string
promTwirpRequestStatusCounter.WithLabelValues(service, method, statusFamily, string(code)).Add(1)
}
func RecordTwirpRequestLatency(service, method string, duration time.Duration) {
promTwirpRequestLatency.WithLabelValues(service, method).Observe(float64(duration.Milliseconds()))
func RecordTwirpRequestLatency(service, method string, duration time.Duration, statusFamily string) {
promTwirpRequestLatency.WithLabelValues(service, method, statusFamily).Observe(float64(duration.Milliseconds()))
}