AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Encapsulates the information sent to either create a metric or add new values to be aggregated into an existing metric.
Namespace: Amazon.CloudWatch.Model
Assembly: AWSSDK.CloudWatch.dll
Version: 3.x.y.z
public class MetricDatum
The MetricDatum type exposes the following members
Name | Description | |
---|---|---|
MetricDatum() |
Name | Type | Description | |
---|---|---|---|
Counts | System.Collections.Generic.List<System.Double> |
Gets and sets the property Counts.
Array of numbers that is used along with the
If you omit the |
|
Dimensions | System.Collections.Generic.List<Amazon.CloudWatch.Model.Dimension> |
Gets and sets the property Dimensions. The dimensions associated with the metric. |
|
MetricName | System.String |
Gets and sets the property MetricName. The name of the metric. |
|
StatisticValues | Amazon.CloudWatch.Model.StatisticSet |
Gets and sets the property StatisticValues. The statistical values for the metric. |
|
StorageResolution | System.Int32 |
Gets and sets the property StorageResolution. Valid values are 1 and 60. Setting this to 1 specifies this metric as a high-resolution metric, so that CloudWatch stores the metric with sub-minute resolution down to one second. Setting this to 60 specifies this metric as a regular-resolution metric, which CloudWatch stores at 1-minute resolution. Currently, high resolution is available only for custom metrics. For more information about high-resolution metrics, see High-Resolution Metrics in the Amazon CloudWatch User Guide. This field is optional, if you do not specify it the default of 60 is used. |
|
Timestamp | System.DateTime |
Gets and sets the property TimestampUtc. This property is deprecated. Setting this property results in non-UTC DateTimes not being marshalled correctly. Use TimestampUtc instead. Setting either Timestamp or TimestampUtc results in both Timestamp and TimestampUtc being assigned, the latest assignment to either one of the two property is reflected in the value of both. Timestamp is provided for backwards compatibility only and assigning a non-Utc DateTime to it results in the wrong timestamp being passed to the service. The time the metric data was received, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. |
|
TimestampUtc | System.DateTime |
Gets and sets the property TimestampUtc. The time the metric data was received, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. |
|
Unit | Amazon.CloudWatch.StandardUnit |
Gets and sets the property Unit.
When you are using a
In a |
|
Value | System.Double |
Gets and sets the property Value. The value for the metric. Although the parameter accepts numbers of type Double, CloudWatch rejects values that are either too small or too large. Values must be in the range of -2^360 to 2^360. In addition, special values (for example, NaN, +Infinity, -Infinity) are not supported. |
|
Values | System.Collections.Generic.List<System.Double> |
Gets and sets the property Values.
Array of numbers representing the values for the metric during the period. Each unique
value is listed just once in this array, and the corresponding number in the
Although the |
This example shows how to publish a set of metric data points.
var client = new AmazonCloudWatchClient(); var dimension = new Dimension { Name = "Desktop Machine Metrics", Value = "Virtual Desktop Machine Usage" }; var metric1 = new MetricDatum { Dimensions = new List<Dimension>() { dimension }, MetricName = "Desktop Machines Online", StatisticValues = new StatisticSet(), Timestamp = DateTime.Today, Unit = StandardUnit.Count, Value = 14 }; var metric2 = new MetricDatum { Dimensions = new List<Dimension>() { dimension }, MetricName = "Desktop Machines Offline", StatisticValues = new StatisticSet(), Timestamp = DateTime.Today, Unit = StandardUnit.Count, Value = 7 }; var metric3 = new MetricDatum { Dimensions = new List<Dimension>() { dimension }, MetricName = "Desktop Machines Online", StatisticValues = new StatisticSet(), Timestamp = DateTime.Today, Unit = StandardUnit.Count, Value = 12 }; var metric4 = new MetricDatum { Dimensions = new List<Dimension>() { dimension }, MetricName = "Desktop Machines Offline", StatisticValues = new StatisticSet(), Timestamp = DateTime.Today, Unit = StandardUnit.Count, Value = 9 }; var request = new PutMetricDataRequest { MetricData = new List<MetricDatum>() { metric1, metric2, metric3, metric4 }, Namespace = "Example.com Custom Metrics" }; client.PutMetricData(request);
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer, 3.5