Example #1
0
        protected virtual ICollector <IObserver> CreateHttpRequestDurationHistogram()
        {
            var configuration = new HistogramConfiguration
            {
                SuppressInitialValue = true,
                LabelNames           = DefaultRequestDurationLabels,
                Buckets = new[] { 0.1, 0.2, 0.5, 1, 2 }
            };

            _options.ConfigureRequestDurationHistogram?.Invoke(configuration);

            if (configuration.LabelNames != DefaultRequestDurationLabels)
            {
                throw new ArgumentException("The requests in progress histogram configuration is missing the required default labels");
            }

            return(_metrics.CreateHistogram("http_server_request_duration_seconds", "The duration in seconds that HTTP requests take to process", configuration));
        }