in src/Core/Exporters/Concrete/ClusterExporter.cs [65:104]
protected override async Task ReportMetrics(object component)
{
var clusterComponent = (ClusterComponent)component;
var hostsTasksList = ExportHostsMetricsAsync(clusterComponent.HostEntryList);
// Constructing labels
var labels = new Dictionary<string, string>()
{
{ "ClusterName", clusterComponent.ClusterReport.ClusterName },
{ "Component", "Cluster" },
};
labels.TryAdd(_clusterConfiguration.DefaultLabels);
// Health Report
PrometheusUtils.ReportGauge(Collectors, "HealthReport_HeartbeatLost", clusterComponent.ClusterReport.HealthReport.HeartbeatLost, labels);
PrometheusUtils.ReportGauge(Collectors, "HealthReport_HostsStateHealthy", clusterComponent.ClusterReport.HealthReport.HostsStateHealthy, labels);
PrometheusUtils.ReportGauge(Collectors, "HealthReport_HostsStateHealthy", clusterComponent.ClusterReport.HealthReport.HostsStateUnhealthy, labels);
PrometheusUtils.ReportGauge(Collectors, "HealthReport_HostsStatusAlert", clusterComponent.ClusterReport.HealthReport.HostsStatusAlert, labels);
PrometheusUtils.ReportGauge(Collectors, "HealthReport_HostsStatusHealthy", clusterComponent.ClusterReport.HealthReport.HostsStatusHealthy, labels);
PrometheusUtils.ReportGauge(Collectors, "HealthReport_HostsStatusUnhealthy", clusterComponent.ClusterReport.HealthReport.HostsStatusUnhealthy, labels);
PrometheusUtils.ReportGauge(Collectors, "HealthReport_HostsStatusUnknown", clusterComponent.ClusterReport.HealthReport.HostsStatusUnknown, labels);
PrometheusUtils.ReportGauge(Collectors, "HealthReport_HostsWithMaintenanceFlag", clusterComponent.ClusterReport.HealthReport.HostsWithMaintenanceFlag, labels);
PrometheusUtils.ReportGauge(Collectors, "HealthReport_HostsWithStaleConfig", clusterComponent.ClusterReport.HealthReport.HostsWithStaleConfig, labels);
// Alerts Summary
PrometheusUtils.ReportGauge(Collectors, "AlertsSummary_Critical", clusterComponent.AlertsSummary.Critical, labels);
PrometheusUtils.ReportGauge(Collectors, "AlertsSummary_Maintenance", clusterComponent.AlertsSummary.Maintenance, labels);
PrometheusUtils.ReportGauge(Collectors, "AlertsSummary_Ok", clusterComponent.AlertsSummary.Ok, labels);
PrometheusUtils.ReportGauge(Collectors, "AlertsSummary_Unknown", clusterComponent.AlertsSummary.Unknown, labels);
PrometheusUtils.ReportGauge(Collectors, "AlertsSummary_Warning", clusterComponent.AlertsSummary.Warning, labels);
// Alerts Summary Hosts
PrometheusUtils.ReportGauge(Collectors, "AlertsSummaryHosts_Critical", clusterComponent.AlertsSummaryHosts.Critical, labels);
PrometheusUtils.ReportGauge(Collectors, "AlertsSummaryHosts_Ok", clusterComponent.AlertsSummaryHosts.Ok, labels);
PrometheusUtils.ReportGauge(Collectors, "AlertsSummaryHosts_Unknown", clusterComponent.AlertsSummaryHosts.Unknown, labels);
PrometheusUtils.ReportGauge(Collectors, "AlertsSummaryHosts_Warning", clusterComponent.AlertsSummaryHosts.Warning, labels);
// Waiting for hosts
await Task.WhenAll(hostsTasksList);
}