/// <summary>
        /// Configure global NancyFx Metrics.
        /// Available global metrics are: Request Timer, Active Requests Counter, Error Meter
        /// <code>
        /// protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        /// {
        ///     base.ApplicationStartup(container, pipelines);
        ///
        ///     NancyMetrics.Configure()
        ///         .WithGlobalMetrics(config => config.RegisterAllMetrics(pipelines))
        ///         .WithMetricsEndpoint();
        /// }
        /// </code>
        /// </summary>
        /// <param name="config">Action to configure which global metrics to enable.</param>
        /// <param name="context">Name of the MetricsContext where to register the NancyFx metrics.</param>
        /// <returns>This instance to allow chaining of the configuration.</returns>
        public NancyMetricsConfig WithNancyMetrics(Action <NancyGlobalMetrics> config, string context = "NancyFx")
        {
            var globalMetrics = new NancyGlobalMetrics(this.metricsContext.Context(context), this.nancyPipelines);

            config(globalMetrics);
            return(this);
        }
Exemple #2
0
        /// <summary>
        /// Configure global NancyFx Metrics.
        /// Available global metrics are: Request Timer, Active Requests Counter, Error Meter
        /// <code>
        /// protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        /// {
        ///     base.ApplicationStartup(container, pipelines);
        ///
        ///     NancyMetrics.Configure()
        ///         .WithGlobalMetrics(config => config.RegisterAllMetrics(pipelines))
        ///         .WithMetricsEndpoint();
        /// }
        /// </code>
        /// </summary>
        /// <param name="config">Action to configure which global metrics to enable.</param>
        /// <param name="context">Name of the MetricsContext where to register the NancyFx metrics.</param>
        /// <returns>This instance to allow chaining of the configuration.</returns>
        public NancyMetricsConfig WithNancyMetrics(Action <NancyGlobalMetrics> config, string context = "NancyFx")
        {
            if (_isDiabled)
            {
                return(this);
            }

            var globalMetrics = new NancyGlobalMetrics(_metricsContext.Context(context), _nancyPipelines);

            config(globalMetrics);
            return(this);
        }
 /// <summary>
 /// Configure global NancyFx Metrics.
 /// Available global metrics are: Request Timer, Active Requests Counter, Error Meter
 /// <code>
 /// protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
 /// {
 ///     base.ApplicationStartup(container, pipelines);
 /// 
 ///     NancyMetrics.Configure()
 ///         .WithGlobalMetrics(config => config.RegisterAllMetrics(pipelines))
 ///         .WithMetricsEndpoint();
 /// }
 /// </code>
 /// </summary>
 /// <param name="config">Action to configure which global metrics to enable.</param>
 /// <param name="context">Name of the MetricsContext where to register the NancyFx metrics.</param>
 /// <returns>This instance to allow chaining of the configuration.</returns>
 public NancyMetricsConfig WithNancyMetrics(Action<NancyGlobalMetrics> config, string context = "NancyFx")
 {
     var globalMetrics = new NancyGlobalMetrics(this.metricsContext.Context(context), this.nancyPipelines);
     config(globalMetrics);
     return this;
 }
 /// <summary>
 /// Configure global NancyFx Metrics.
 /// Available global metrics are: Request Timer, Active Requests Counter, Error Meter
 /// <code>
 /// protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
 /// {
 ///     base.ApplicationStartup(container, pipelines);
 /// 
 ///     NancyMetrics.Configure()
 ///         .WithGlobalMetrics(config => config.RegisterAllMetrics(pipelines))
 ///         .WithMetricsEndpoint();
 /// }
 /// </code>
 /// </summary>
 /// <param name="config">Action to configure which global metrics to enable</param>
 /// <returns>This instance to allow chaining of the configuration.</returns>
 public NancyMetricsConfig WithGlobalMetrics(Action<NancyGlobalMetrics> config)
 {
     this.globalMetrics = new NancyGlobalMetrics(this.metricsRegistry);
     config(this.globalMetrics);
     return this;
 }
        //public HealthChecksRegistry HealthChecks { get { return this.healthChecksRegistry; } }

        /// <summary>
        /// Configure global NancyFx Metrics.
        /// Available global metrics are: Request Timer, Active Requests Counter, Error Meter
        /// <code>
        /// protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        /// {
        ///     base.ApplicationStartup(container, pipelines);
        ///
        ///     NancyMetrics.Configure()
        ///         .WithGlobalMetrics(config => config.RegisterAllMetrics(pipelines))
        ///         .WithMetricsEndpoint();
        /// }
        /// </code>
        /// </summary>
        /// <param name="config">Action to configure which global metrics to enable</param>
        /// <returns>This instance to allow chaining of the configuration.</returns>
        public NancyMetricsConfig WithGlobalMetrics(Action <NancyGlobalMetrics> config)
        {
            this.globalMetrics = new NancyGlobalMetrics(this.metricsRegistry);
            config(this.globalMetrics);
            return(this);
        }