Ejemplo n.º 1
0
 public void UpdateNumMsgsReceived(IMessage <T> message)
 {
     if (message != null)
     {
         _numMsgsReceived.Increment();
         _numBytesReceived.Add(message.Data.Length);
     }
 }
Ejemplo n.º 2
0
        public void UpdateCumulativeStats(IProducerStats stats)
        {
            if (stats == null)
            {
                return;
            }

            _numMsgsSent.Add(stats.NumMsgsSent);
            _numBytesSent.Add(stats.NumBytesSent);
            _numSendFailed.Add(stats.NumSendFailed);
            _numAcksReceived.Add(stats.NumAcksReceived);
            _totalMsgsSent.Add(stats.NumMsgsSent);
            _totalBytesSent.Add(stats.NumBytesSent);
            _totalSendFailed.Add(stats.NumSendFailed);
            _totalAcksReceived.Add(stats.NumAcksReceived);
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public void Record(long duration, TimeUnit unit, string userValue = null)
        {
            var nanos = unit.ToNanoseconds(duration);

            if (nanos < 0)
            {
                return;
            }

            _histogram.Update(nanos, userValue);
            _meter.Mark(userValue);
            _totalRecordedTime.Add(nanos);
        }
Ejemplo n.º 4
0
        private void StatsAction()
        {
            try
            {
                long now     = DateTime.Now.Millisecond;
                var  elapsed = (now - OldTime) / 1e9;
                _oldTime = now;
                var currentNumMsgsReceived       = _numMsgsReceived.GetAndReset();
                var currentNumBytesReceived      = _numBytesReceived.GetAndReset();
                var currentNumReceiveFailed      = _numReceiveFailed.GetAndReset();
                var currentNumBatchReceiveFailed = _numBatchReceiveFailed.GetAndReset();
                var currentNumAcksSent           = _numAcksSent.GetAndReset();
                var currentNumAcksFailed         = _numAcksFailed.GetAndReset();

                _totalMsgsReceived.Add(currentNumMsgsReceived);
                _totalBytesReceived.Add(currentNumBytesReceived);
                _totalReceiveFailed.Add(currentNumReceiveFailed);
                _totalBatchReceiveFailed.Add(currentNumBatchReceiveFailed);
                _totalAcksSent.Add(currentNumAcksSent);
                _totalAcksFailed.Add(currentNumAcksFailed);

                RateMsgsReceived  = currentNumMsgsReceived / elapsed;
                RateBytesReceived = currentNumBytesReceived / elapsed;

                if ((currentNumMsgsReceived | currentNumBytesReceived | currentNumReceiveFailed | currentNumAcksSent | currentNumAcksFailed) != 0)
                {
                    _log.Info($"[{_topic}] [{_subscription}] [{_name}] Consume throughput received: {(RateMsgsReceived).ToString(ThroughputFormat)} msgs/s --- {(RateBytesReceived * 8 / 1024 / 1024).ToString(ThroughputFormat)} Mbit/s --- Ack sent rate: {(currentNumAcksSent / elapsed).ToString(ThroughputFormat)} ack/s --- Failed messages: {currentNumReceiveFailed} --- batch messages: {currentNumBatchReceiveFailed} ---Failed acks: {currentNumAcksFailed}");
                }
            }
            catch (Exception e)
            {
                _log.Error($"[{_topic}] [{_name}] [{_subscription}]: {e.Message}");
            }
            finally
            {
                // schedule the next stat info
                _statTimeout = _system.Scheduler.Advanced.ScheduleOnceCancelable(TimeSpan.FromSeconds(_statsIntervalSeconds), StatsAction);
            }
        }
Ejemplo n.º 5
0
 public void UpdateCumulativeStats(IConsumerStats stats)
 {
     if (stats == null)
     {
         return;
     }
     _numMsgsReceived.Add(stats.NumMsgsReceived);
     _numBytesReceived.Add(stats.NumBytesReceived);
     _numReceiveFailed.Add(stats.NumReceiveFailed);
     _numBatchReceiveFailed.Add(stats.NumBatchReceiveFailed);
     _numAcksSent.Add(stats.NumAcksSent);
     _numAcksFailed.Add(stats.NumAcksFailed);
     _totalMsgsReceived.Add(stats.TotalMsgsReceived);
     _totalBytesReceived.Add(stats.TotalBytesReceived);
     _totalReceiveFailed.Add(stats.TotalReceivedFailed);
     _totalBatchReceiveFailed.Add(stats.TotaBatchReceivedFailed);
     _totalAcksSent.Add(stats.TotalAcksSent);
     _totalAcksFailed.Add(stats.TotalAcksFailed);
 }
Ejemplo n.º 6
0
 /// <inheritdoc />
 public virtual void Mark(long count)
 {
     _uncounted.Add(count);
 }
Ejemplo n.º 7
0
 public void Can_add_value()
 {
     _num.Add(7L);
     _num.GetValue().Should().Be(7L);
 }
Ejemplo n.º 8
0
 protected override void addToTotalCount(long value)
 {
     totalCount.Add(value);
 }
Ejemplo n.º 9
0
 /// <inheritdoc />
 public void Decrement(long value)
 {
     _counter.Add(-value);
 }
Ejemplo n.º 10
0
 public void IncrementSendFailed(long numMsgs)
 {
     _numSendFailed.Add(numMsgs);
 }
Ejemplo n.º 11
0
 public void UpdateNumMsgsSent(long numMsgs, long totalMsgsSize)
 {
     _numMsgsSent.Add(numMsgs);
     _numBytesSent.Add(totalMsgsSize);
 }
Ejemplo n.º 12
0
 public void IncrementNumAcksSent(long numAcks)
 {
     _numAcksSent.Add(numAcks);
 }