From fd181c433c209f70b4f9f03e1cc608da1b235224 Mon Sep 17 00:00:00 2001 From: Daniel Marbach Date: Mon, 16 Jun 2025 11:26:32 +0200 Subject: [PATCH 1/5] Upgrade ASB Co-authored-by: Irina Scurtu --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index fac0eaca..5c68e8eb 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -10,7 +10,7 @@ - + From 64f1f97a5870357e4b1c9e90aee7cf511d11eaab Mon Sep 17 00:00:00 2001 From: Daniel Marbach Date: Mon, 16 Jun 2025 11:29:54 +0200 Subject: [PATCH 2/5] Upgrade Azure.Identity Co-authored-by: Irina Scurtu --- src/Directory.Packages.props | 2 +- src/Query/AzureServiceBus/AzureClient.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 5c68e8eb..ee3a9f29 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -9,7 +9,7 @@ - + diff --git a/src/Query/AzureServiceBus/AzureClient.cs b/src/Query/AzureServiceBus/AzureClient.cs index 1fdc99b4..be17827a 100644 --- a/src/Query/AzureServiceBus/AzureClient.cs +++ b/src/Query/AzureServiceBus/AzureClient.cs @@ -53,7 +53,9 @@ IEnumerable CreateCredentials() yield return new EnvironmentCredential(); yield return new SharedTokenCacheCredential(); yield return new VisualStudioCredential(); +#pragma warning disable CS0618 // Type or member is obsolete yield return new VisualStudioCodeCredential(); +#pragma warning restore CS0618 // Type or member is obsolete // Don't really need this one to take 100s * 4 tries to finally time out var opts = new TokenCredentialOptions(); From adaccd94ab1cf2414d66cdb155884289c526862d Mon Sep 17 00:00:00 2001 From: Daniel Marbach Date: Mon, 16 Jun 2025 11:32:39 +0200 Subject: [PATCH 3/5] Upgrade Microsoft.Data.SqlClient --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index ee3a9f29..be0fdba0 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -14,7 +14,7 @@ - + From 450e2fc3c69e0b15021edd87beaa7b186d198da7 Mon Sep 17 00:00:00 2001 From: Daniel Marbach Date: Mon, 16 Jun 2025 11:33:52 +0200 Subject: [PATCH 4/5] Update NuGet.Versioning Co-authored-by: Irina Scurtu --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index be0fdba0..8480adcd 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -18,7 +18,7 @@ - + From d5eb420ed067101a6adb55997e12e7f5508e83af Mon Sep 17 00:00:00 2001 From: Daniel Marbach Date: Mon, 16 Jun 2025 11:57:22 +0200 Subject: [PATCH 5/5] Upgrade the AWS.SDK to v4 Co-authored-by: Irina Scurtu --- src/AppCommon/Commands/SqsCommand.cs | 6 +++--- src/Directory.Packages.props | 6 +++--- src/Query/AmazonSQS/AwsQuery.cs | 27 +++++++++++++++------------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/AppCommon/Commands/SqsCommand.cs b/src/AppCommon/Commands/SqsCommand.cs index 54d2aa99..118ed765 100644 --- a/src/AppCommon/Commands/SqsCommand.cs +++ b/src/AppCommon/Commands/SqsCommand.cs @@ -96,9 +96,9 @@ protected override async Task GetData(CancellationToken cancellati return new QueueDetails { - StartTime = new DateTimeOffset(aws.StartTimeUtc, TimeSpan.Zero), - EndTime = new DateTimeOffset(aws.EndTimeUtc, TimeSpan.Zero), - Queues = data.OrderBy(q => q.QueueName).ToArray(), + StartTime = new DateTimeOffset(aws.StartDate.ToDateTime(TimeOnly.MinValue), TimeSpan.Zero), + EndTime = new DateTimeOffset(aws.EndDate.ToDateTime(TimeOnly.MaxValue), TimeSpan.Zero), + Queues = [.. data.OrderBy(q => q.QueueName)], TimeOfObservation = TimeSpan.FromDays(1) }; } diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 8480adcd..83c106a2 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/Query/AmazonSQS/AwsQuery.cs b/src/Query/AmazonSQS/AwsQuery.cs index d39f95fc..d478c1f9 100644 --- a/src/Query/AmazonSQS/AwsQuery.cs +++ b/src/Query/AmazonSQS/AwsQuery.cs @@ -17,8 +17,8 @@ public class AwsQuery readonly AmazonSQSClient sqs; readonly FixedWindowRateLimiter rateLimiter; - public DateTime EndTimeUtc { get; set; } - public DateTime StartTimeUtc { get; set; } + public DateOnly EndDate { get; set; } + public DateOnly StartDate { get; set; } public string CloudWatchRegion => cloudWatch.Config.RegionEndpoint.SystemName; public string SQSRegion => sqs.Config.RegionEndpoint.SystemName; @@ -34,8 +34,8 @@ public AwsQuery() // Otherwise AcquireAsync() will return a lease immediately with IsAcquired = false QueueLimit = int.MaxValue }); - EndTimeUtc = DateTime.UtcNow.Date.AddDays(1); - StartTimeUtc = EndTimeUtc.AddDays(-30); + EndDate = DateOnly.FromDateTime(DateTime.UtcNow).AddDays(1); + StartDate = EndDate.AddDays(-30); sqs = new AmazonSQSClient(); cloudWatch = new AmazonCloudWatchClient(); @@ -58,7 +58,10 @@ public async Task> GetQueueNames(Action onProgress, Cancellati var response = await sqs.ListQueuesAsync(request, cancellationToken).ConfigureAwait(false); - queueNames.AddRange(response.QueueUrls.Select(url => url.Split('/')[4]).ToArray()); + if (response.QueueUrls is { Count: > 0 }) + { + queueNames.AddRange(response.QueueUrls.Select(url => url.Split('/')[4]).ToArray()); + } onProgress(queueNames.Count); @@ -86,19 +89,19 @@ public async Task GetMaxThroughput(string queueName, CancellationToken can { Namespace = "AWS/SQS", MetricName = "NumberOfMessagesDeleted", - StartTimeUtc = StartTimeUtc, - EndTimeUtc = EndTimeUtc, - Period = 86400, // 1 day + StartTime = StartDate.ToDateTime(TimeOnly.MinValue), + EndTime = EndDate.ToDateTime(TimeOnly.MaxValue), + Period = 24 * 60 * 60, // 1 day Statistics = ["Sum"], - Dimensions = [new Dimension { Name = "QueueName", Value = queueName }] + Dimensions = [ + new Dimension { Name = "QueueName", Value = queueName }] }; using var lease = await rateLimiter.AcquireAsync(cancellationToken: cancellationToken).ConfigureAwait(false); var resp = await cloudWatch.GetMetricStatisticsAsync(req, cancellationToken).ConfigureAwait(false); - var maxThroughput = resp.Datapoints.MaxBy(d => d.Sum)?.Sum ?? 0; - - return (long)maxThroughput; + return resp.Datapoints is { Count: > 0 } ? + (long)resp.Datapoints.Select(d => d.Sum.GetValueOrDefault(0)).Max() : 0L; } } }