/// <summary> /// this is used in web host /// </summary> /// <param name="app"></param> /// <param name="settings"></param> public static void UsePrometheus(this IApplicationBuilder app, PrometheusMetricSettings settings) { app.UsePrometheusServer(options => { options.UseDefaultCollectors = true; options.MapPath = settings.Route; }); }
/// <summary> /// this is used in console (GenericHost) app /// </summary> /// <param name="services"></param> /// <param name="settings"></param> public static void UsePrometheus(this IServiceCollection services, PrometheusMetricSettings settings) { var metricServer = new MetricServer(null, new MetricServerOptions() { Port = settings.Port, MapPath = settings.Route, Host = "localhost" }); metricServer.Start(); }