Пример #1
0
        public void RecordMessageReceivedMetric(Message message, int bytesReceived)
        {
            PayloadTypeMetric metric = this.GetPayloadTypeMetric(message.Payload);

            lock (this.locker)
            {
                metric.ReceivedCount++;
                metric.BytesReceivedCount += bytesReceived;
            }
        }
Пример #2
0
        public void RecordMessageSentMetric(Message message, int bytesSent)
        {
            PayloadTypeMetric metric = this.GetPayloadTypeMetric(message.Payload);

            lock (this.locker)
            {
                metric.SentCount++;
                metric.BytesSentCount += bytesSent;
            }
        }
Пример #3
0
        public PayloadTypeMetric GetPayloadTypeMetric(Type type)
        {
            lock (this.locker)
            {
                if (!this.payloadTypeMetrics.TryGetValue(type, out PayloadTypeMetric metric))
                {
                    metric = new PayloadTypeMetric();

                    this.payloadTypeMetrics[type] = metric;
                }

                return(metric);
            }
        }