How to update custom Cloudwatch tag in C #?

How to create custom metrics for my Elastic Beanstalk environment in C #?

I have a numerical metric seconds.

I am using the following code:

 double seconds = ts.Seconds + (Convert.ToDouble(ts.Milliseconds / 10) / 100);

 using (AmazonCloudWatchClient cloudwatch = new AmazonCloudWatchClient(accessKey, secretKey))
  {
          PutMetricDataRequest mdr = new PutMetricDataRequest();
           mdr.Namespace = "Performance";

           MetricDatum dataPoint = new MetricDatum();
            dataPoint.MetricName = "UploadSpeedInSeconds";
            dataPoint.Unit = "Seconds";
            dataPoint.Value = seconds;
  }

I had no idea what to continue. I want a custom metric to load files in seconds. I already have a metric value and I want to update my own metric so that I can track it (BTW: can I view a custom metric in the console?).

+4
source share
1 answer

Remember to send it to AWS:

            mdr.MetricData = new List<MetricDatum>();
            mdr.MetricData.Add(dataPoint);

            PutMetricDataResponse resp = cloudwatch.PutMetricData(mdr);
            Debug.Assert(resp.HttpStatusCode == System.Net.HttpStatusCode.OK);
+7
source

Source: https://habr.com/ru/post/1529478/


All Articles