コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixedLimit" /> class.
        /// </summary>
        /// <param name="limit">The limit.</param>
        /// <param name="metricsRegistry">The metrics registry.</param>
        public FixedLimit(int limit, IMetricsRegistry metricsRegistry)
        {
            this.limit = limit;

            var maxOperations = metricsRegistry.CreateGauge(
                Metrics.MaxOperations.Name,
                Metrics.MaxOperations.Description,
                new[] { Metrics.Labels.LimitTypeName });

            maxOperations.WithLabels(new[] { Metrics.Labels.LimitTypeValue }).Set(limit);

            this.currentOperations = metricsRegistry.CreateGauge(
                Metrics.CurrentOperations.Name,
                Metrics.CurrentOperations.Description,
                new[] { Metrics.Labels.LimitTypeName })
                                     .WithLabels(new[] { Metrics.Labels.LimitTypeValue });
        }