public NancyMetricsCollector(IRouteResolver routeResolver, IEnumerable <ISystemMetricCollector> collectors, NancyMetricsCollectorOptions options = null)
        {
            RouteResolver = routeResolver;
            Options       = options ?? new NancyMetricsCollectorOptions();

            ErrorRequestsProcessed   = Metrics.CreateCounter("server_request_error_total", "Number of unsuccessfull processed requests.", "method", "error_code");
            OngoingRequests          = Metrics.CreateGauge("server_request_in_progress", "Number of ongoing requests.", "method");
            RequestResponseHistogram = Metrics.CreateHistogram("server_request_duration_seconds", "Histogram of request duration in seconds.",
                                                               new HistogramConfiguration()
            {
                LabelNames = new string[] { "method" },
                Buckets    = Options.Buckets
            });
            var registry = Metrics.DefaultRegistry;

            foreach (var collector in collectors)
            {
                registry.AddBeforeCollectCallback(collector.UpdateMetrics);
            }
        }
 public NancyMetricsCollector(IRouteResolver routeResolver, NancyMetricsCollectorOptions options = null, bool registerDefaultCollectors = true) :
     this(routeResolver,
          (registerDefaultCollectors ? new List <ISystemMetricCollector>() { new ThreadPoolCollector() } : new List <ISystemMetricCollector>()),
          options)
 {
 }