/// <summary> /// Expose the metrics information at: /// /metrics in human readable format /// /metrics/json in json format /// <code> /// protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) /// { /// base.ApplicationStartup(container, pipelines); /// /// NancyMetrics.Configure() /// .WithGlobalMetrics(config => config.RegisterAllMetrics(pipelines)) /// .WithMetricsEndpoint(m => m.RequiresAuthentication()); // to enable authentication /// } /// </code> /// </summary> /// <param name="moduleConfig">Action that can configure the Metrics Module ( for example to apply authentication )</param> /// <param name="config">Action that can configure the endpoint reports</param> /// <param name="metricsPath">Path where to expose the metrics</param> /// <returns>This instance to allow chaining of the configuration.</returns> public NancyMetricsConfig WithMetricsModule(Action <INancyModule> moduleConfig, Action <MetricsEndpointReports> config, string metricsPath = "/metrics") { var reportsConfig = new MetricsEndpointReports(this.metricsContext.DataProvider, this.healthStatus); config(reportsConfig); MetricsModule.Configure(moduleConfig, reportsConfig, metricsPath); return(this); }
/// <summary> /// Expose the metrics information at: /// /metrics in human readable format /// /metrics/json in json format /// <code> /// protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) /// { /// base.ApplicationStartup(container, pipelines); /// /// NancyMetrics.Configure() /// .WithGlobalMetrics(config => config.RegisterAllMetrics(pipelines)) /// .WithMetricsEndpoint(m => m.RequiresAuthentication()); // to enable authentication /// } /// </code> /// </summary> /// <param name="moduleConfig">Action that can configure the Metrics Module ( for example to apply authentication )</param> /// <param name="metricsPath">Path where to expose the metrics</param> /// <returns>This instance to allow chaining of the configuration.</returns> public NancyMetricsConfig WithMetricsModule(Action <INancyModule> moduleConfig, string metricsPath = "/metrics") { MetricsModule.Configure(this.metricsContext.DataProvider, this.healthStatus, moduleConfig, metricsPath); return(this); }