예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleLimiter"/> class.
        /// </summary>
        /// <param name="limit">The limit to use.</param>
        /// <param name="metricsRegistry">The metrics registry.</param>
        public SimpleLimiter(ILimit limit, IMetricsRegistry metricsRegistry)
        {
            this.limit = limit;

            this.operationsExecuted = metricsRegistry.CreateCounter(
                Metrics.Executed.Name,
                Metrics.Executed.Description,
                new[] { Metrics.Labels.LimiterTypeName })
                                      .WithLabels(new[] { Metrics.Labels.LimiterTypeDescription });
            this.operationsLimited = metricsRegistry.CreateCounter(
                Metrics.Limited.Name,
                Metrics.Limited.Description,
                new[] { Metrics.Labels.LimiterTypeName })
                                     .WithLabels(new[] { Metrics.Labels.LimiterTypeDescription });
        }