fix(server): shed overloaded group websocket fanout

This commit is contained in:
richjohnrambo
2026-10-07 21:23:22 +08:00
parent 58c15efad5
commit ac6cd3c6e8
4 changed files with 57 additions and 2 deletions
+9 -1
View File
@@ -209,6 +209,10 @@ var (
Name: "im_topic_shared_serialization_total",
Help: "Shared WebSocket serialization events by pod, topic kind, and result.",
}, []string{"pod", "kind", "result"})
TopicBroadcastDropTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "im_topic_broadcast_drop_total",
Help: "Realtime topic broadcasts skipped by pod, topic kind, role, and reason.",
}, []string{"pod", "kind", "role", "reason"})
ClusterM2PQueueWaitDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Name: "im_cluster_m2p_queue_wait_duration_seconds",
Help: "Time a master-to-proxy response waited in the multiplex outbound queue by pod and peer.",
@@ -282,7 +286,7 @@ func init() {
ClusterRouteTotal, ClusterProxyResponseTotal, InternalQueueEnqueueTotal, InternalQueueDepth,
InternalQueueCapacity, InternalQueueCurrent, MessagePersistDuration, MessagePublishStageDuration, TopicQueueWaitDuration,
TopicProcessDuration, TopicBroadcastDuration, TopicBroadcastTargets, TopicSharedSerializationTotal,
ClusterM2PQueueWaitDuration, ClusterM2PQueueDepth, ClusterProxyQueueWaitDuration, WSReadDispatchDuration,
TopicBroadcastDropTotal, ClusterM2PQueueWaitDuration, ClusterM2PQueueDepth, ClusterProxyQueueWaitDuration, WSReadDispatchDuration,
PushDispatchQueueEnqueueTotal, PushDispatchQueueDepth, PushDispatchQueueWaitDuration,
PushDispatchDuration, PushRecipientCount,
KafkaMessagePersistTotal)
@@ -339,6 +343,10 @@ func IncTopicSharedSerialization(kind, result string) {
TopicSharedSerializationTotal.WithLabelValues(metricPodName(), normalizeLabel(kind), normalizeLabel(result)).Inc()
}
func IncTopicBroadcastDrop(kind, role, reason string) {
TopicBroadcastDropTotal.WithLabelValues(metricPodName(), normalizeLabel(kind), normalizeLabel(role), normalizeLabel(reason)).Inc()
}
func ObserveClusterM2PEnqueue(peer string, depth int) {
ClusterM2PQueueDepth.WithLabelValues(metricPodName(), normalizeLabel(peer)).Observe(float64(depth))
}