From 2972ea434c587dba8ddd85d7f8c897c1ebad155c Mon Sep 17 00:00:00 2001 From: Daniel Marbach Date: Fri, 15 Mar 2024 09:19:10 +0000 Subject: [PATCH] Monitoring todo (#4007) * Delete unneeded class * Replace TODO with explanation * Removed OWIN namespace and folder --- .../{OWIN => WebApi}/BodyUrlRouteFix.cs | 2 +- .../WebApplicationExtensions.cs | 2 +- .../When_querying_queue_length_data.cs | 2 +- .../WebApi/UnderscoreMappingResolver.cs | 15 --------------- .../{OWIN => WebApi}/BodyUrlRouteFix.cs | 2 +- src/ServiceControl/WebApplicationExtensions.cs | 2 +- 6 files changed, 5 insertions(+), 20 deletions(-) rename src/ServiceControl.Audit/Infrastructure/{OWIN => WebApi}/BodyUrlRouteFix.cs (94%) delete mode 100644 src/ServiceControl.Monitoring/Infrastructure/WebApi/UnderscoreMappingResolver.cs rename src/ServiceControl/Infrastructure/{OWIN => WebApi}/BodyUrlRouteFix.cs (95%) diff --git a/src/ServiceControl.Audit/Infrastructure/OWIN/BodyUrlRouteFix.cs b/src/ServiceControl.Audit/Infrastructure/WebApi/BodyUrlRouteFix.cs similarity index 94% rename from src/ServiceControl.Audit/Infrastructure/OWIN/BodyUrlRouteFix.cs rename to src/ServiceControl.Audit/Infrastructure/WebApi/BodyUrlRouteFix.cs index 9792811d06..52afcb4d75 100644 --- a/src/ServiceControl.Audit/Infrastructure/OWIN/BodyUrlRouteFix.cs +++ b/src/ServiceControl.Audit/Infrastructure/WebApi/BodyUrlRouteFix.cs @@ -1,4 +1,4 @@ -namespace ServiceControl.Audit.Infrastructure.OWIN +namespace ServiceControl.Audit.Infrastructure.WebApi { using System.Threading.Tasks; using Microsoft.AspNetCore.Http; diff --git a/src/ServiceControl.Audit/WebApplicationExtensions.cs b/src/ServiceControl.Audit/WebApplicationExtensions.cs index ddb62b7736..905f62da29 100644 --- a/src/ServiceControl.Audit/WebApplicationExtensions.cs +++ b/src/ServiceControl.Audit/WebApplicationExtensions.cs @@ -1,7 +1,7 @@ namespace ServiceControl.Audit; +using Infrastructure.WebApi; using Microsoft.AspNetCore.Builder; -using Infrastructure.OWIN; public static class WebApplicationExtensions { diff --git a/src/ServiceControl.Monitoring.AcceptanceTests/When_querying_queue_length_data.cs b/src/ServiceControl.Monitoring.AcceptanceTests/When_querying_queue_length_data.cs index 31e560f980..19883e5956 100644 --- a/src/ServiceControl.Monitoring.AcceptanceTests/When_querying_queue_length_data.cs +++ b/src/ServiceControl.Monitoring.AcceptanceTests/When_querying_queue_length_data.cs @@ -82,7 +82,7 @@ await Define() return false; } - // TODO this should be using camalCase (the same for a few other monitoring acceptance tests, something sounds off with the json options + // Metric names are fixed names and therefore are not following the casing rules of the chosen serializer if (monitoredEndpointDetails.Digest.Metrics.TryGetValue("QueueLength", out var queueLength) && queueLength.Average == 0.0) { return false; diff --git a/src/ServiceControl.Monitoring/Infrastructure/WebApi/UnderscoreMappingResolver.cs b/src/ServiceControl.Monitoring/Infrastructure/WebApi/UnderscoreMappingResolver.cs deleted file mode 100644 index a7ee11ba4d..0000000000 --- a/src/ServiceControl.Monitoring/Infrastructure/WebApi/UnderscoreMappingResolver.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace ServiceControl.Monitoring.Infrastructure.WebApi -{ - using System.Globalization; - using System.Text.RegularExpressions; - using Newtonsoft.Json.Serialization; - - class UnderscoreMappingResolver : DefaultContractResolver - { - protected override string ResolvePropertyName(string propertyName) - { - return Regex.Replace( - propertyName, "([A-Z])([A-Z][a-z])|([a-z0-9])([A-Z])", "$1$3_$2$4").ToLower(CultureInfo.InvariantCulture); - } - } -} \ No newline at end of file diff --git a/src/ServiceControl/Infrastructure/OWIN/BodyUrlRouteFix.cs b/src/ServiceControl/Infrastructure/WebApi/BodyUrlRouteFix.cs similarity index 95% rename from src/ServiceControl/Infrastructure/OWIN/BodyUrlRouteFix.cs rename to src/ServiceControl/Infrastructure/WebApi/BodyUrlRouteFix.cs index 8ca2a3f3d4..78a8dba4e6 100644 --- a/src/ServiceControl/Infrastructure/OWIN/BodyUrlRouteFix.cs +++ b/src/ServiceControl/Infrastructure/WebApi/BodyUrlRouteFix.cs @@ -1,4 +1,4 @@ -namespace ServiceControl.Infrastructure.OWIN +namespace ServiceControl.Infrastructure.WebApi { using System.Threading.Tasks; using Microsoft.AspNetCore.Http; diff --git a/src/ServiceControl/WebApplicationExtensions.cs b/src/ServiceControl/WebApplicationExtensions.cs index 51f202f6fd..a5ca376937 100644 --- a/src/ServiceControl/WebApplicationExtensions.cs +++ b/src/ServiceControl/WebApplicationExtensions.cs @@ -1,7 +1,7 @@ namespace ServiceControl; -using Infrastructure.OWIN; using Infrastructure.SignalR; +using Infrastructure.WebApi; using Microsoft.AspNetCore.Builder; public static class WebApplicationExtensions