/// <summary> /// /// </summary> /// <param name="config"></param> /// <param name="path"></param> /// <param name="encoding"></param> /// <param name="reportConfig"></param> /// <returns></returns> public static MetricsEndpointReports WithPrometheusEndpointReport( this MetricsEndpointReports config, string path, Encoding encoding, PrometheusReportConfig reportConfig = null) { reportConfig = reportConfig ?? new PrometheusReportConfig(); return(config.WithEndpointReport(path, (d, h, c) => new MetricsEndpointResponse(PrometheusReport.RenderMetrics(d, h, reportConfig), "text/plain", encoding))); }
/// <summary> /// /// </summary> /// <param name="currentMetricsData"></param> /// <param name="healthStatus"></param> /// <param name="config"></param> /// <returns></returns> public static string RenderMetrics( MetricsData currentMetricsData, Func <HealthStatus> healthStatus, PrometheusReportConfig config) { var report = new PrometheusReport(config); report.RunReport(currentMetricsData, healthStatus, CancellationToken.None); return(report._reportText.ToString()); }
private PrometheusReport(PrometheusReportConfig config) { _config = config; _reportText = new StringBuilder(); }
/// <summary> /// /// </summary> /// <param name="config"></param> /// <param name="path"></param> /// <param name="reportConfig"></param> /// <returns></returns> public static MetricsEndpointReports WithPrometheusEndpointReport(this MetricsEndpointReports config, string path = "prometheus", PrometheusReportConfig reportConfig = null) { Encoding utf8WithoutBom = new UTF8Encoding(false); return(WithPrometheusEndpointReport(config, path, utf8WithoutBom, reportConfig)); }