From fa763395da50dbac5f36e72b4a9adb949511b76e Mon Sep 17 00:00:00 2001 From: Jayendran Arumugam <25414541+jayendranarumugam@users.noreply.github.com> Date: Wed, 11 Dec 2024 07:27:40 +0000 Subject: [PATCH] adjusments --- .../Discovery/StubResourceDiscoveryRepository.cs | 8 ++++---- .../Serialization/v1/Core/AggregationDeserializer.cs | 4 ++-- .../Serialization/Yaml/YamlSerialization.cs | 4 ++-- .../RecordArmRateLimitMetricsPolicy.cs | 2 +- .../AzureResourceManagerThrottlingRequestHandler.cs | 2 +- .../OpenTelemetryCollectorMetricSink.cs | 4 ++-- .../Generators/ScrapeResultGenerator.cs | 10 +++++----- .../DeserializerTests/DeserializationTests.cs | 6 +++--- .../AzureAuthenticationValidationStepTests.cs | 1 - 9 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/Promitor.Agents.Scraper/Discovery/StubResourceDiscoveryRepository.cs b/src/Promitor.Agents.Scraper/Discovery/StubResourceDiscoveryRepository.cs index 0327ec7ab..0295f8d6e 100644 --- a/src/Promitor.Agents.Scraper/Discovery/StubResourceDiscoveryRepository.cs +++ b/src/Promitor.Agents.Scraper/Discovery/StubResourceDiscoveryRepository.cs @@ -8,17 +8,17 @@ namespace Promitor.Agents.Scraper.Discovery { public class StubResourceDiscoveryRepository : IResourceDiscoveryRepository { - private static readonly List EmptyResourceDefinitions = new(); - private static readonly AgentHealthReport HealthReport = new(); + private static readonly List emptyResourceDefinitions = new(); + private static readonly AgentHealthReport healthReport = new(); public Task> GetResourceDiscoveryGroupAsync(string resourceDiscoveryGroupName) { - return Task.FromResult(EmptyResourceDefinitions); + return Task.FromResult(emptyResourceDefinitions); } public Task GetHealthAsync() { - return Task.FromResult(HealthReport); + return Task.FromResult(healthReport); } } } diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Core/AggregationDeserializer.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Core/AggregationDeserializer.cs index 02b8b9f20..0d3d66481 100644 --- a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Core/AggregationDeserializer.cs +++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Core/AggregationDeserializer.cs @@ -6,12 +6,12 @@ namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Core { public class AggregationDeserializer : Deserializer { - private static readonly TimeSpan DefaultAggregationInterval = TimeSpan.FromMinutes(5); + private static readonly TimeSpan defaultAggregationInterval = TimeSpan.FromMinutes(5); public AggregationDeserializer(ILogger logger) : base(logger) { Map(aggregation => aggregation.Interval) - .WithDefault(DefaultAggregationInterval); + .WithDefault(defaultAggregationInterval); } } } diff --git a/src/Promitor.Core/Serialization/Yaml/YamlSerialization.cs b/src/Promitor.Core/Serialization/Yaml/YamlSerialization.cs index 2638d24f6..74b391243 100644 --- a/src/Promitor.Core/Serialization/Yaml/YamlSerialization.cs +++ b/src/Promitor.Core/Serialization/Yaml/YamlSerialization.cs @@ -5,12 +5,12 @@ namespace Promitor.Core.Serialization.Yaml { public static class YamlSerialization { - private static readonly INamingConvention NamingConvention = CamelCaseNamingConvention.Instance; + private static readonly INamingConvention namingConvention = CamelCaseNamingConvention.Instance; public static ISerializer CreateSerializer() { var builder = new SerializerBuilder(); - builder.WithNamingConvention(NamingConvention); + builder.WithNamingConvention(namingConvention); builder.ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitDefaults); return builder.Build(); diff --git a/src/Promitor.Integrations.AzureMonitor/HttpPipelinePolicies/RecordArmRateLimitMetricsPolicy.cs b/src/Promitor.Integrations.AzureMonitor/HttpPipelinePolicies/RecordArmRateLimitMetricsPolicy.cs index 3000106cf..f440599df 100644 --- a/src/Promitor.Integrations.AzureMonitor/HttpPipelinePolicies/RecordArmRateLimitMetricsPolicy.cs +++ b/src/Promitor.Integrations.AzureMonitor/HttpPipelinePolicies/RecordArmRateLimitMetricsPolicy.cs @@ -75,7 +75,7 @@ private string DetermineApplicationId(AzureAuthenticationInfo azureAuthenticatio case AuthenticationMode.SystemAssignedManagedIdentity: return "system-assigned-identity"; case AuthenticationMode.SdkDefault: - return "default-azure-credentials"; + return "default-azure-credentials"; default: throw new ArgumentOutOfRangeException(nameof(azureAuthenticationInfo.Mode)); } diff --git a/src/Promitor.Integrations.AzureMonitor/RequestHandlers/AzureResourceManagerThrottlingRequestHandler.cs b/src/Promitor.Integrations.AzureMonitor/RequestHandlers/AzureResourceManagerThrottlingRequestHandler.cs index a81db05f4..104adafca 100644 --- a/src/Promitor.Integrations.AzureMonitor/RequestHandlers/AzureResourceManagerThrottlingRequestHandler.cs +++ b/src/Promitor.Integrations.AzureMonitor/RequestHandlers/AzureResourceManagerThrottlingRequestHandler.cs @@ -98,7 +98,7 @@ private string DetermineApplicationId(AzureAuthenticationInfo azureAuthenticatio case AuthenticationMode.SystemAssignedManagedIdentity: return "system-assigned-identity"; case AuthenticationMode.SdkDefault: - return "default-azure-credentials"; + return "default-azure-credentials"; default: throw new ArgumentOutOfRangeException(nameof(azureAuthenticationInfo.Mode)); } diff --git a/src/Promitor.Integrations.Sinks.OpenTelemetry/OpenTelemetryCollectorMetricSink.cs b/src/Promitor.Integrations.Sinks.OpenTelemetry/OpenTelemetryCollectorMetricSink.cs index b0bd3d5be..cba785007 100644 --- a/src/Promitor.Integrations.Sinks.OpenTelemetry/OpenTelemetryCollectorMetricSink.cs +++ b/src/Promitor.Integrations.Sinks.OpenTelemetry/OpenTelemetryCollectorMetricSink.cs @@ -17,7 +17,7 @@ namespace Promitor.Integrations.Sinks.OpenTelemetry public class OpenTelemetryCollectorMetricSink : MetricSink, IMetricSink { private readonly ILogger _logger; - private static readonly Meter AzureMonitorMeter = new Meter("Promitor.Scraper.Metrics.AzureMonitor", "1.0"); + private static readonly Meter azureMonitorMeter = new Meter("Promitor.Scraper.Metrics.AzureMonitor", "1.0"); public MetricSinkType Type => MetricSinkType.OpenTelemetryCollector; @@ -74,7 +74,7 @@ public Task ReportMetricAsync(string metricName, string metricDescription, doubl private void InitializeNewMetric(string metricName, string metricDescription) { - var gauge = AzureMonitorMeter.CreateObservableGauge(metricName, description: metricDescription, observeValues: () => ReportMeasurementsForMetric(metricName)); + var gauge = azureMonitorMeter.CreateObservableGauge(metricName, description: metricDescription, observeValues: () => ReportMeasurementsForMetric(metricName)); _gauges.TryAdd(metricName, gauge); _measurements.TryAdd(metricName, []); diff --git a/src/Promitor.Tests.Unit/Generators/ScrapeResultGenerator.cs b/src/Promitor.Tests.Unit/Generators/ScrapeResultGenerator.cs index cf27d6878..9248c0723 100644 --- a/src/Promitor.Tests.Unit/Generators/ScrapeResultGenerator.cs +++ b/src/Promitor.Tests.Unit/Generators/ScrapeResultGenerator.cs @@ -7,14 +7,14 @@ namespace Promitor.Tests.Unit.Generators { public class ScrapeResultGenerator { - private static readonly Faker Bogus = new(); + private static readonly Faker bogus = new(); public static ScrapeResult GenerateFromMetric(MeasuredMetric measuredMetric) { - var subscriptionId = Bogus.Name.FirstName(); - var resourceGroupName = Bogus.Name.FirstName(); - var instanceName = Bogus.Name.FirstName(); - var resourceUri = Bogus.Internet.Url(); + var subscriptionId = bogus.Name.FirstName(); + var resourceGroupName = bogus.Name.FirstName(); + var instanceName = bogus.Name.FirstName(); + var resourceUri = bogus.Internet.Url(); return new ScrapeResult(subscriptionId, resourceGroupName, instanceName, resourceUri, new List {measuredMetric}); } diff --git a/src/Promitor.Tests.Unit/Serialization/DeserializerTests/DeserializationTests.cs b/src/Promitor.Tests.Unit/Serialization/DeserializerTests/DeserializationTests.cs index afeb55da8..14c3e9869 100644 --- a/src/Promitor.Tests.Unit/Serialization/DeserializerTests/DeserializationTests.cs +++ b/src/Promitor.Tests.Unit/Serialization/DeserializerTests/DeserializationTests.cs @@ -10,7 +10,7 @@ namespace Promitor.Tests.Unit.Serialization.DeserializerTests { public class DeserializationTests : UnitTest { - private static readonly TimeSpan DefaultInterval = TimeSpan.FromMinutes(5); + private static readonly TimeSpan defaultInterval = TimeSpan.FromMinutes(5); private readonly Mock _errorReporter = new(); private readonly Mock> _childDeserializer = new(); @@ -171,7 +171,7 @@ public void Deserialize_MapOptional_CanSpecifyDefaultValue() var result = _deserializer.Deserialize(node, _errorReporter.Object); // Assert - Assert.Equal(DefaultInterval, result.DefaultedInterval); + Assert.Equal(defaultInterval, result.DefaultedInterval); } [Fact] @@ -268,7 +268,7 @@ public RegistrationConfigDeserializer(IDeserializer childDeserializer) : Map(t => t.Classes).IsRequired(); Map(t => t.Town); Map(t => t.Interval); - Map(t => t.DefaultedInterval).WithDefault(DefaultInterval); + Map(t => t.DefaultedInterval).WithDefault(defaultInterval); Map(t => t.NullableInterval); Map(t => t.InvertedProperty) .MapUsing(InvertBooleanString); diff --git a/src/Promitor.Tests.Unit/Validation/Authentication/AzureAuthenticationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Authentication/AzureAuthenticationValidationStepTests.cs index d511ab29e..2ee86388a 100644 --- a/src/Promitor.Tests.Unit/Validation/Authentication/AzureAuthenticationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Authentication/AzureAuthenticationValidationStepTests.cs @@ -304,7 +304,6 @@ public void SystemAssignedManagedIdentity_ValidWithoutApplicationKey_Succeeds() PromitorAssert.ValidationIsSuccessful(validationResult); } - [Fact] public void SdkDefault_ValidWithoutApplicationKey_Succeeds() {