@@ -14,6 +14,7 @@ namespace ServiceControl.Transports.SQS;
1414using Amazon . CloudWatch . Model ;
1515using Amazon . Runtime ;
1616using Amazon . Runtime . CredentialManagement ;
17+ using Amazon . Runtime . Credentials ;
1718using Amazon . SQS ;
1819using Amazon . SQS . Model ;
1920using BrokerThroughput ;
@@ -29,7 +30,7 @@ public class AmazonSQSQuery(ILogger<AmazonSQSQuery> logger, TimeProvider timePro
2930 protected override void InitializeCore ( ReadOnlyDictionary < string , string > settings )
3031 {
3132 var sqsConnectionString = new SQSTransportConnectionString ( transportSettings . ConnectionString ) ;
32- AWSCredentials credentials = FallbackCredentialsFactory . GetCredentials ( ) ;
33+ AWSCredentials credentials = DefaultAWSCredentialsIdentityResolver . GetCredentials ( ) ;
3334 RegionEndpoint ? regionEndpoint = null ;
3435 if ( settings . TryGetValue ( AmazonSQSSettings . Profile , out string ? profile ) )
3536 {
@@ -197,8 +198,8 @@ public override async IAsyncEnumerable<QueueThroughput> GetThroughputPerDay(IBro
197198 {
198199 Namespace = "AWS/SQS" ,
199200 MetricName = "NumberOfMessagesDeleted" ,
200- StartTimeUtc = startDate . ToDateTime ( TimeOnly . MinValue ) ,
201- EndTimeUtc = endDate . ToDateTime ( TimeOnly . MaxValue ) ,
201+ StartTime = startDate . ToDateTime ( TimeOnly . MinValue ) ,
202+ EndTime = endDate . ToDateTime ( TimeOnly . MaxValue ) ,
202203 Period = 24 * 60 * 60 , // 1 day
203204 Statistics = [ "Sum" ] ,
204205 Dimensions = [
@@ -222,7 +223,10 @@ public override async IAsyncEnumerable<QueueThroughput> GetThroughputPerDay(IBro
222223 // There is a bug in the AWS SDK. The timestamp is actually UTC time, eventhough the DateTime returned type says Local
223224 // See https://github.com/aws/aws-sdk-net/issues/167
224225 // So do not convert the timestamp to UTC time!
225- data [ DateOnly . FromDateTime ( datapoint . Timestamp ) ] . TotalThroughput = ( long ) datapoint . Sum ;
226+ if ( datapoint . Timestamp . HasValue )
227+ {
228+ data [ DateOnly . FromDateTime ( datapoint . Timestamp . Value ) ] . TotalThroughput = ( long ) datapoint . Sum . GetValueOrDefault ( 0 ) ;
229+ }
226230 }
227231
228232 foreach ( QueueThroughput queueThroughput in data . Values )
0 commit comments