@@ -651,25 +651,30 @@ type transportMessagesReceived struct {
651651 counterReceivedSize prometheus.Counter
652652}
653653
654- func (m * metrics ) incTransportMessagesSent (transport string , frameType protocol.FrameType , channel string , size int ) {
655- channelNamespace := m .getChannelNamespaceLabel (channel )
654+ func (m * metrics ) getTransportMessagesSentCounters (transport string , frameType string , namespace string ) transportMessagesSent {
656655 labels := transportMessageLabels {
657656 Transport : transport ,
658- ChannelNamespace : channelNamespace ,
659- FrameType : frameType . String () ,
657+ ChannelNamespace : namespace ,
658+ FrameType : frameType ,
660659 }
661660 counters , ok := m .transportMessagesSentCache .Load (labels )
662661 if ! ok {
663- counterSent := m .transportMessagesSent .WithLabelValues (transport , labels . FrameType , channelNamespace )
664- counterSentSize := m .transportMessagesSentSize .WithLabelValues (transport , labels . FrameType , channelNamespace )
662+ counterSent := m .transportMessagesSent .WithLabelValues (transport , frameType , namespace )
663+ counterSentSize := m .transportMessagesSentSize .WithLabelValues (transport , frameType , namespace )
665664 counters = transportMessagesSent {
666665 counterSent : counterSent ,
667666 counterSentSize : counterSentSize ,
668667 }
669668 m .transportMessagesSentCache .Store (labels , counters )
670669 }
671- counters .(transportMessagesSent ).counterSent .Inc ()
672- counters .(transportMessagesSent ).counterSentSize .Add (float64 (size ))
670+ return counters .(transportMessagesSent )
671+ }
672+
673+ func (m * metrics ) incTransportMessagesSent (transport string , frameType protocol.FrameType , channel string , size int ) {
674+ channelNamespace := m .getChannelNamespaceLabel (channel )
675+ counters := m .getTransportMessagesSentCounters (transport , frameType .String (), channelNamespace )
676+ counters .counterSent .Inc ()
677+ counters .counterSentSize .Add (float64 (size ))
673678}
674679
675680func (m * metrics ) incTransportMessagesReceived (transport string , frameType protocol.FrameType , channel string , size int ) {
0 commit comments