/// <inheritdoc/> protected override async Task <PutMetricDataResponse> SendRequestAsync(PutMetricDataRequest putMetricDataRequest) { // Failover if (_failoverSinkEnabled) { // Failover to Secondary Region _ = FailOverToSecondaryRegion(_throttle); } PutMetricDataResponse response; try { response = await CloudWatchClient.PutMetricDataAsync(putMetricDataRequest); _throttle.SetSuccess(); } catch (Exception) { _throttle.SetError(); throw; } return(response); }
// [Fact] public async Task Test1() { var client = new CloudWatchClient(AwsRegion.USEast1, credential); var result = await client.ListMetricsAsyncAsync(new ListMetricsRequest { Namespace = "AWS/ELB", MetricName = "HealthyHostCount" }); // throw new Exception(result); }
//[Fact] public async Task Test2() { var client = new CloudWatchClient(AwsRegion.USEast1, credential); var result = await client.GetMetricStatisticsAsync(new GetMetricStatisticsRequest("AWS/ELB", "HealthyHostCount") { StartTime = DateTime.UtcNow.AddHours(-12), EndTime = DateTime.UtcNow, Period = TimeSpan.FromHours(1), Statistics = new[] { Statistic.Average } }); // throw new System.Exception(result); }
/// <inheritdoc/> public AmazonCloudWatchClient FailOverToSecondaryRegion(Throttle throttle) { var _cloudWatchClient = _failoverSink.FailOverToSecondaryRegion(_throttle); if (_cloudWatchClient is not null) { // Jittered Delay var delay = _throttle.GetDelayMilliseconds(1); if (delay > 0) { Task.Delay((int)(delay * (1.0d + Utility.Random.NextDouble() * ConfigConstants.DEFAULT_JITTING_FACTOR))).Wait(); } // Dispose CloudWatchClient.Dispose(); // Override client CloudWatchClient = _cloudWatchClient; } return(null); }
public void TestMethod1() { var client = new CloudWatchClient(); client.GetTableInformation("TestTable", DateTime.UtcNow.AddHours(-8), DateTime.UtcNow); }