コード例 #1
0
        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);
        }
コード例 #2
0
 internal IDisposable ConsumeTimer() => PrometheusMetrics.ConsumeTimer(_messageType).Timer();