internal void MeasureCriticalTime() { if (_context.SentTime != null) { PrometheusMetrics.CriticalTimer(_messageType) .Observe((DateTime.UtcNow - _context.SentTime.Value).TotalSeconds); } }
public Task PostConsume <T>(ConsumeContext <T> context, TimeSpan duration, string consumerType) where T : class { var messageType = typeof(T).Name; PrometheusMetrics.ConsumeTimer(messageType).Observe(duration.TotalSeconds); PrometheusMetrics.MessageCounter(messageType).Inc(); if (context.SentTime != null) { PrometheusMetrics.CriticalTimer(messageType) .Observe((DateTime.UtcNow - context.SentTime.Value).TotalSeconds); } return(Task.CompletedTask); }