Permalink
Switch branches/tags
Nothing to show
Find file Copy path
825c6b5 Jan 4, 2018
3 contributors

Users who have contributed to this file

@soo-aws @EronHennessey @beckandros
56 lines (40 sloc) 2.25 KB

Publishing Custom Metric Data

A number of AWS services publish :cw-ug:`their own metrics <aws-namespaces>` in namespaces beginning with "AWS/" You can also publish custom metric data using your own namespace (as long as it doesn't begin with "AWS/").

Publish Custom Metric Data

To publish your own metric data, call the |cwclient|'s :methodname:`putMetricData` method with a :aws-java-class:`PutMetricDataRequest <services/cloudwatch/model/PutMetricDataRequest>`. The :classname:`PutMetricDataRequest` must include the custom namespace to use for the data, and information about the data point itself in a :aws-java-class:`MetricDatum <services/cloudwatch/model/MetricDatum>` object.

Note

You cannot specify a namespace that begins with "AWS/". Namespaces that begin with "AWS/" are reserved for use by Amazon Web Services products.

Imports

.. literalinclude:: example_code/cloudwatch/src/main/java/aws/example/cloudwatch/PutMetricData.java
   :lines: 16-22
   :language: java

Code

.. literalinclude:: example_code/cloudwatch/src/main/java/aws/example/cloudwatch/PutMetricData.java
   :lines: 41-58
   :dedent: 8
   :language: java

More Information