/// <summary>
        /// Initializes a new instance of the <see cref="SendMessagesDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public SendMessagesDecorator(IMetrics metrics,
            ISendMessages handler,
            IConnectionInformation connectionInformation)
        {
            var name = handler.GetType().Name;
            _sendTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendTimer", Units.Calls);
            _sendBatchTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchTimer", Units.Calls);
            _sendAsyncTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendAsyncTimer", Units.Calls);
            _sendBatchAsyncTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchAsyncTimer", Units.Calls);

            _sendMeter = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesMeter", Units.Items, TimeUnits.Minutes);
            _sendErrorMeter = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesErrorMeter", Units.Items, TimeUnits.Minutes);
            _handler = handler;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SendMessagesDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public SendMessagesDecorator(IMetrics metrics,
                                     ISendMessages handler,
                                     IConnectionInformation connectionInformation)
        {
            var name = handler.GetType().Name;

            _sendTimer           = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendTimer", Units.Calls);
            _sendBatchTimer      = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchTimer", Units.Calls);
            _sendAsyncTimer      = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendAsyncTimer", Units.Calls);
            _sendBatchAsyncTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchAsyncTimer", Units.Calls);

            _sendMeter      = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesMeter", Units.Items, TimeUnits.Minutes);
            _sendErrorMeter = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesErrorMeter", Units.Items, TimeUnits.Minutes);
            _handler        = handler;
        }