@@ -208,10 +208,15 @@ public override async IAsyncEnumerable<QueueThroughput> GetThroughputPerDay(IBro
208208 yield break ;
209209 }
210210
211+ // Convert DATES that state up to but INCLUDING the TO value to a timestamp from X to Y EXCLUDING
212+ // Example: 2025-01-01 to 2025-01-10 => 2025-01-01T00:00:00 to 2025-01-11T00:00:00
213+
211214 var queryStartUtc = startDate . ToDateTime ( TimeOnly . MinValue , DateTimeKind . Utc ) ;
212- var queryendUtc = endDate . AddDays ( 1 ) . ToDateTime ( TimeOnly . MinValue , DateTimeKind . Utc ) ;
215+ var queryEndUtc = endDate
216+ . AddDays ( 1 ) // Convert from INCLUDING to EXCLUDING, thus need to bump one day, using ToDateTime(TimeOnly.MaxValue) would be wrong
217+ . ToDateTime ( TimeOnly . MinValue , DateTimeKind . Utc ) ;
213218
214- logger . LogDebug ( "GetThroughputPerDay {QueueName} {UtcNow} {StartDate} {EndDate} {QueryStart} {QueryEnd}" , brokerQueue . QueueName , utcNow , startDate , endDate , queryStartUtc , queryendUtc ) ;
219+ logger . LogDebug ( "GetThroughputPerDay {QueueName} {UtcNow} {StartDate} {EndDate} {QueryStart} {QueryEnd}" , brokerQueue . QueueName , utcNow , startDate , endDate , queryStartUtc , queryEndUtc ) ;
215220
216221 const int SecondsInDay = 24 * 60 * 60 ;
217222
@@ -220,7 +225,7 @@ public override async IAsyncEnumerable<QueueThroughput> GetThroughputPerDay(IBro
220225 Namespace = "AWS/SQS" ,
221226 MetricName = "NumberOfMessagesDeleted" ,
222227 StartTime = queryStartUtc ,
223- EndTime = queryendUtc , // exclusive
228+ EndTime = queryEndUtc , // The value specified is exclusive; results include data points up to the specified time stamp.
224229 Period = SecondsInDay ,
225230 Statistics = [ "Sum" ] ,
226231 Dimensions =
0 commit comments