public void RecordMessageReceivedMetric(Message message, int bytesReceived) { PayloadTypeMetric metric = this.GetPayloadTypeMetric(message.Payload); lock (this.locker) { metric.ReceivedCount++; metric.BytesReceivedCount += bytesReceived; } }
public void RecordMessageSentMetric(Message message, int bytesSent) { PayloadTypeMetric metric = this.GetPayloadTypeMetric(message.Payload); lock (this.locker) { metric.SentCount++; metric.BytesSentCount += bytesSent; } }
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); } }