/// <summary>
        /// Initializes a new instance of the <see cref="ExpressionSerializerDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ExpressionSerializerDecorator(IMetrics metrics,
            IExpressionSerializer handler,
            IConnectionInformation connectionInformation)
        {
            var name = handler.GetType().Name;
            _methodToBytesTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.ConvertMethodToBytesTimer", Units.Calls);
            _bytesToMethodTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.ConvertBytesToMethodTimer", Units.Calls);
            _resultMethodSizeHistogram = metrics.Histogram($"{connectionInformation.QueueName}.{name}.ConvertMethodToBytesHistogram", Units.Bytes,
                SamplingTypes.LongTerm);

            _functionToBytesTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.ConvertFunctionToBytesTimer", Units.Calls);
            _bytesToFunctionTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.ConvertBytesToFunctionTimer", Units.Calls);
            _resultFunctionSizeHistogram = metrics.Histogram($"{connectionInformation.QueueName}.{name}.ConvertFunctionToBytesHistogram", Units.Bytes,
                SamplingTypes.LongTerm);

            _handler = handler;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExpressionSerializerDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ExpressionSerializerDecorator(IMetrics metrics,
                                             IExpressionSerializer handler,
                                             IConnectionInformation connectionInformation)
        {
            var name = handler.GetType().Name;

            _methodToBytesTimer        = metrics.Timer($"{connectionInformation.QueueName}.{name}.ConvertMethodToBytesTimer", Units.Calls);
            _bytesToMethodTimer        = metrics.Timer($"{connectionInformation.QueueName}.{name}.ConvertBytesToMethodTimer", Units.Calls);
            _resultMethodSizeHistogram = metrics.Histogram($"{connectionInformation.QueueName}.{name}.ConvertMethodToBytesHistogram", Units.Bytes,
                                                           SamplingTypes.LongTerm);

            _functionToBytesTimer        = metrics.Timer($"{connectionInformation.QueueName}.{name}.ConvertFunctionToBytesTimer", Units.Calls);
            _bytesToFunctionTimer        = metrics.Timer($"{connectionInformation.QueueName}.{name}.ConvertBytesToFunctionTimer", Units.Calls);
            _resultFunctionSizeHistogram = metrics.Histogram($"{connectionInformation.QueueName}.{name}.ConvertFunctionToBytesHistogram", Units.Bytes,
                                                             SamplingTypes.LongTerm);

            _handler = handler;
        }