diff --git a/src/Promitor.Core.Scraping/Configuration/Model/Metrics/ScrapeDefinitionBatchProperties.cs b/src/Promitor.Core.Scraping/Configuration/Model/Metrics/ScrapeDefinitionBatchProperties.cs index b3f8868bf..8755e71cd 100644 --- a/src/Promitor.Core.Scraping/Configuration/Model/Metrics/ScrapeDefinitionBatchProperties.cs +++ b/src/Promitor.Core.Scraping/Configuration/Model/Metrics/ScrapeDefinitionBatchProperties.cs @@ -95,7 +95,7 @@ public string BuildBatchHashKey() /// public bool Equals(ScrapeDefinitionBatchProperties obj) { - if (obj is null || !(obj is ScrapeDefinitionBatchProperties)) + if (!(obj is ScrapeDefinitionBatchProperties)) return false; ScrapeDefinitionBatchProperties other = obj; diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/MetricsDeclarationV1.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/MetricsDeclarationV1.cs index 8f7dae4dd..4c4e80082 100644 --- a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/MetricsDeclarationV1.cs +++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/MetricsDeclarationV1.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Promitor.Core.Scraping.Configuration.Model; using Promitor.Core.Serialization.Enum; namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Model diff --git a/src/Promitor.Core.Scraping/LogAnalyticsScraper.cs b/src/Promitor.Core.Scraping/LogAnalyticsScraper.cs index b0f117b5a..3f32d30a4 100644 --- a/src/Promitor.Core.Scraping/LogAnalyticsScraper.cs +++ b/src/Promitor.Core.Scraping/LogAnalyticsScraper.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Net; using System.Threading.Tasks; using GuardNet; -using Microsoft.VisualBasic; using Promitor.Core.Contracts; using Promitor.Core.Contracts.ResourceTypes; using Promitor.Core.Metrics; @@ -55,7 +53,6 @@ private Dictionary DetermineMetricLabels(LogAnalyticsResourceDef protected override async Task> BatchScrapeResourceAsync(string subscriptionId, BatchScrapeDefinition batchScrapeDefinition, PromitorMetricAggregationType aggregationType, TimeSpan aggregationInterval) { - // TODO: these just dispatch and await on tasks that do single-resource scraping. Implement integration with Log Analytics batch endpoint var logScrapingTasks = batchScrapeDefinition.ScrapeDefinitions.Select(definition => ScrapeResourceAsync(subscriptionId, definition, (LogAnalyticsResourceDefinition) definition.Resource, aggregationType, aggregationInterval)).ToList(); var resultsList = await Task.WhenAll(logScrapingTasks); diff --git a/src/Promitor.Core/Extensions/MeasureMetricExtensions.cs b/src/Promitor.Core/Extensions/MeasureMetricExtensions.cs index 34baeff60..a886ab27e 100644 --- a/src/Promitor.Core/Extensions/MeasureMetricExtensions.cs +++ b/src/Promitor.Core/Extensions/MeasureMetricExtensions.cs @@ -4,6 +4,7 @@ namespace Promitor.Core.Extensions { public static class MeasuredMetricExtensions { + /// A time series value /// Resource ID to associate the metric with /// Instance of MeasuredMetric subclass with resourceId attached public static ResourceAssociatedMeasuredMetric WithResourceIdAssociation(this MeasuredMetric measuredMetric, string resourceId) diff --git a/src/Promitor.Integrations.AzureMonitor/AzureMonitorQueryClient.cs b/src/Promitor.Integrations.AzureMonitor/AzureMonitorQueryClient.cs index 1f8f34ea5..f39ef53a7 100644 --- a/src/Promitor.Integrations.AzureMonitor/AzureMonitorQueryClient.cs +++ b/src/Promitor.Integrations.AzureMonitor/AzureMonitorQueryClient.cs @@ -23,7 +23,6 @@ using Azure.Core.Diagnostics; using System.Diagnostics.Tracing; using Promitor.Integrations.AzureMonitor.Extensions; -using System.Globalization; namespace Promitor.Integrations.AzureMonitor { @@ -302,7 +301,7 @@ private MetricsClient CreateAzureMonitorMetricsBatchClient(AzureCloud azureCloud public static string InsertRegionIntoUrl(string region, string baseUrl) { // Find the position where ".metrics" starts in the URL - int metricsIndex = baseUrl.IndexOf("metrics", System.StringComparison.Ordinal); + int metricsIndex = baseUrl.IndexOf("metrics", StringComparison.Ordinal); // Split the base URL into two parts: before and after the ".metrics" string beforeMetrics = baseUrl.Substring(0, metricsIndex); diff --git a/src/Promitor.Integrations.AzureMonitor/Configuration/AzureMonitorMetricBatchScrapeConfig.cs b/src/Promitor.Integrations.AzureMonitor/Configuration/AzureMonitorMetricBatchScrapeConfig.cs index aa8f2a8cd..817a4ef0b 100644 --- a/src/Promitor.Integrations.AzureMonitor/Configuration/AzureMonitorMetricBatchScrapeConfig.cs +++ b/src/Promitor.Integrations.AzureMonitor/Configuration/AzureMonitorMetricBatchScrapeConfig.cs @@ -1,11 +1,9 @@ -using Azure.Core; - namespace Promitor.Integrations.AzureMonitor.Configuration { public class AzureMonitorMetricBatchScrapeConfig { public bool Enabled { get; set; } = false; public int MaxBatchSize { get; set; } - public string AzureRegion { get; set; } = "eastus"; // Batch scrape endpoints are deployed by region + public string AzureRegion { get; set; } // Batch scrape endpoints are deployed by region } } \ No newline at end of file diff --git a/src/Promitor.Integrations.AzureMonitor/HttpPipelinePolicies/ModifyOutgoingAzureMonitorRequestsPolicy.cs b/src/Promitor.Integrations.AzureMonitor/HttpPipelinePolicies/ModifyOutgoingAzureMonitorRequestsPolicy.cs index 9db3814c2..3acbc1981 100644 --- a/src/Promitor.Integrations.AzureMonitor/HttpPipelinePolicies/ModifyOutgoingAzureMonitorRequestsPolicy.cs +++ b/src/Promitor.Integrations.AzureMonitor/HttpPipelinePolicies/ModifyOutgoingAzureMonitorRequestsPolicy.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Text; using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; diff --git a/src/Promitor.Tests.Unit/Core/Metrics/ScrapeDefinitionBatchPropertiesTest.cs b/src/Promitor.Tests.Unit/Core/Metrics/ScrapeDefinitionBatchPropertiesTest.cs index d9f061fce..c95cc4479 100644 --- a/src/Promitor.Tests.Unit/Core/Metrics/ScrapeDefinitionBatchPropertiesTest.cs +++ b/src/Promitor.Tests.Unit/Core/Metrics/ScrapeDefinitionBatchPropertiesTest.cs @@ -169,7 +169,7 @@ public void BuildBatchHashKeyDifferentResultDifferentSchedule() [Fact] public void BuildBatchHashKeyTest() { - AzureMetricConfigurationV1 _azureMetricConfigurationTest1 = new AzureMetricConfigurationV1 + AzureMetricConfigurationV1 azureMetricConfigurationTest1 = new AzureMetricConfigurationV1 { MetricName = "availabilityResults/availabilityPercentage", Aggregation = new MetricAggregationV1 @@ -177,7 +177,7 @@ public void BuildBatchHashKeyTest() Type = PromitorMetricAggregationType.Average }, }; - AzureMetricConfigurationV1 _azureMetricConfigurationTest2 = new AzureMetricConfigurationV1 + AzureMetricConfigurationV1 azureMetricConfigurationTest2 = new AzureMetricConfigurationV1 { MetricName = "availabilityResults/availabilityPercentage", Dimensions = [new MetricDimensionV1{Name = "availabilityResult/name"}], @@ -186,8 +186,8 @@ public void BuildBatchHashKeyTest() Type = PromitorMetricAggregationType.Average }, }; - var azureMetricConfiguration1 = _mapper.Map(_azureMetricConfigurationTest1); - var azureMetricConfiguration2 = _mapper.Map(_azureMetricConfigurationTest2); + var azureMetricConfiguration1 = _mapper.Map(azureMetricConfigurationTest1); + var azureMetricConfiguration2 = _mapper.Map(azureMetricConfigurationTest2); var scraping1 = _mapper.Map(scrapingBase); var scraping2 = _mapper.Map(scrapingBase); diff --git a/src/Promitor.Tests.Unit/Core/Scraping/Batching/AzureResourceDefinitionBatchingTests.cs b/src/Promitor.Tests.Unit/Core/Scraping/Batching/AzureResourceDefinitionBatchingTests.cs index 68a674481..fa5409718 100644 --- a/src/Promitor.Tests.Unit/Core/Scraping/Batching/AzureResourceDefinitionBatchingTests.cs +++ b/src/Promitor.Tests.Unit/Core/Scraping/Batching/AzureResourceDefinitionBatchingTests.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Threading; using AutoMapper; using Promitor.Core.Contracts; using Promitor.Core.Metrics; @@ -12,7 +11,7 @@ using Promitor.Core.Scraping.Configuration.Serialization.v1.Model; using Xunit; -namespace Promitor.Tests.Unit.Core.Metrics +namespace Promitor.Tests.Unit.Core.Scraping.Batching { [Category("Unit")] public class AzureResourceDefinitionBatchingTests