Skip to content

Commit

Permalink
add more debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hkfgo committed Sep 17, 2024
1 parent 2a42416 commit b77903d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Promitor.Core.Scraping/AzureMonitorScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,15 @@ protected override async Task<List<ScrapeResult>> BatchScrapeResourceAsync(strin
}

var scrapeResults = new List<ScrapeResult>();
// group based on resource, then to enrichment per group
// group based on resource, then do enrichment per group
var groupedMeasuredMetrics = resourceIdTaggedMeasuredMetrics.GroupBy(measuredMetric => measuredMetric.ResourceId);
foreach (IGrouping<string, ResourceAssociatedMeasuredMetric> resourceMetricsGroup in groupedMeasuredMetrics)
{
var resourceId = resourceMetricsGroup.Key;
_resourceDefinitions.TryGetValue(resourceId, out IAzureResourceDefinition resourceDefinition);
var metricLabels = DetermineMetricLabels((TResourceDefinition) batchScrapeDefinition.ScrapeDefinitions[0].Resource);
var finalMetricValues = EnrichMeasuredMetrics((TResourceDefinition) batchScrapeDefinition.ScrapeDefinitions[0].Resource, dimensionNames, resourceMetricsGroup.ToImmutableList());
Logger.LogWarning("Processing {MetricsCount} measured metrics for Metric {MetricName}, resourceID {ResourceId} with name {ResourceName}, of resource group {ResourceGroup}", finalMetricValues.Count, metricName, resourceId, resourceDefinition.ResourceName, resourceDefinition.ResourceGroupName);
scrapeResults.Add(new ScrapeResult(subscriptionId, resourceDefinition.ResourceGroupName, resourceDefinition.ResourceName, resourceId, finalMetricValues, metricLabels));
Logger.LogWarning("Processed {MetricsCount} measured metrics for Metric {MetricName} and resource {ResourceName}", finalMetricValues.Count, metricName, resourceId);
}
Expand Down

0 comments on commit b77903d

Please sign in to comment.