Skip to content

Commit

Permalink
Provide decent ToString for ScrapeResult to improve logging (#661)
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com>
  • Loading branch information
tomkerkhove authored Aug 13, 2019
1 parent f4ce88a commit f869ba9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Promitor.Core.Scraping/ScrapeResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public ScrapeResult(string subscriptionId, string resourceGroupName, string inst
/// <param name="instanceName">Name of the resource that is being scraped</param>
/// <param name="resourceUri">Uri of the resource that was scraped</param>
/// <param name="metricValue">Value of the metric that was found</param>
public ScrapeResult(string subscriptionId, string resourceGroupName, string instanceName, string resourceUri, double? metricValue) : this(subscriptionId, resourceGroupName, instanceName,resourceUri,metricValue, new Dictionary<string, string>())
public ScrapeResult(string subscriptionId, string resourceGroupName, string instanceName, string resourceUri, double? metricValue) : this(subscriptionId, resourceGroupName, instanceName, resourceUri, metricValue, new Dictionary<string, string>())
{
}

Expand Down Expand Up @@ -90,6 +90,14 @@ public ScrapeResult(string subscriptionId, string resourceGroupName, string inst
/// </summary>
public double? MetricValue { get; }

/// <summary>
/// Labels that are related to the metric
/// </summary>
public Dictionary<string, string> Labels { get; } = new Dictionary<string, string>();

public override string ToString()
{
return MetricValue == null ? "No value found" : MetricValue.ToString();
}
}
}

0 comments on commit f869ba9

Please sign in to comment.