private void LogRemoteLockerPerfStat() { var metricsData = remoteLockerMetrics.Context.DataProvider.CurrentMetricsData; var metricsReport = StringReport.RenderMetrics(metricsData, () => new HealthStatus()); Console.Out.WriteLine(metricsReport); }
public Task Invoke(HttpContext context) { if (_options.MetricsTextEnabled && _options.MetricsTextEndpoint.HasValue && _options.MetricsTextEndpoint == context.Request.Path) { var content = StringReport.RenderMetrics(_metricsContext.Context.DataProvider.CurrentMetricsData, _metricsContext.HealthStatus); return(WriteResponse(context, content, "text/plain")); } return(_next(context)); }
public MetricsModule() : base(Config.ModulePath ?? "/") { if (string.IsNullOrEmpty(Config.ModulePath)) { return; } if (Config.ModuleConfigAction != null) { Config.ModuleConfigAction(this); } object[] noCacheHeaders = { new { Header = "Cache-Control", Value = "no-cache, no-store, must-revalidate" }, new { Header = "Pragma", Value = "no-cache" }, new { Header = "Expires", Value = "0" } }; Get["/"] = _ => { if (!this.Request.Url.Path.EndsWith("/")) { return(Response.AsRedirect(this.Request.Url.ToString() + "/")); } var gzip = AcceptsGzip(); var response = Response.FromStream(FlotWebApp.GetAppStream(!gzip), "text/html"); if (gzip) { response.WithHeader("Content-Encoding", "gzip"); } return(response); }; Get["/text"] = _ => Response.AsText(StringReport.RenderMetrics(Config.DataProvider.CurrentMetricsData, Config.HealthStatus)) .WithHeaders(noCacheHeaders); Get["/json"] = _ => Response.AsText(JsonBuilderV1.BuildJson(Config.DataProvider.CurrentMetricsData), "text/json") .WithHeaders(noCacheHeaders); Get["/v2/json"] = _ => Response.AsText(JsonBuilderV2.BuildJson(Config.DataProvider.CurrentMetricsData), "text/json") .WithHeaders(noCacheHeaders); Get["/ping"] = _ => Response.AsText("pong", "text/plain") .WithHeaders(noCacheHeaders); Get["/health"] = _ => GetHealthStatus() .WithHeaders(noCacheHeaders); }
private static Task GetAsHumanReadable(IDictionary <string, object> environment, MetricsDataProvider dataProvider, Func <HealthStatus> healthStatus) { string text = StringReport.RenderMetrics(dataProvider.CurrentMetricsData, healthStatus); return(WriteResponse(environment, text, "text/plain")); }
private static void WriteTextMetrics(HttpListenerContext context, MetricsDataProvider metricsDataProvider, Func <HealthStatus> healthStatus) { var text = StringReport.RenderMetrics(metricsDataProvider.CurrentMetricsData, healthStatus); WriteString(context, text, "text/plain"); }
public string GenerateReport() { MetricsData metricsData = this._metricsContext.DataProvider.CurrentMetricsData; return(StringReport.RenderMetrics(metricsData, HealthChecks.GetStatus)); }