Skip to content

CloudWatch Metrics

If you are using a dedicated device cloud running in your AWS account and capturing device logs into AWS CloudWatch, Ioto provides a convenience wrapper to make defining AWS cloudwatch metrics easier.

AWS CloudWatch is a monitoring and management service that provides data and actionable insights to monitor devices and get a unified view of operational health.

AWS CloudWatch offers metrics for monitoring specific aspects of your applications. However, AWS custom metrics can become costly when updated or queried frequently, with each custom metric costing up to $3.60 per metric per year, along with additional expenses for querying. If you have a significant number of metrics or high dimensionality in your metrics, this could result in a substantial CloudWatch Metrics bill.

A better solution is to use the Ioto CustomMetrics support that offers a cost-effective alternative that is considerably more budget-friendly and efficient compared to standard CloudWatch metrics.

Read about Ioto Custom Metrics.

API Tour

To emit metrics to AWS CloudWatch, use the rmetrics API. This uses the CloudWatch EMF log format.

Note: Ioto provides more cost effective metrics via the Ioto Metrics. It is generally preferable to use these metrics unless you have a hard requirements to use AWS CloudWatch.

rmetrics("Fan Temperature", "Acme/Rocket", "Fan", "Temp", "int", 101, "Fan", "string", "fan-0", NULL);

This would emit the metric "fan-0" temperature is 101 degrees. After this call, CloudWatch or the EmbedThis builder UI can display the fan temperature graph over time.

The rmetrics API

The arguments of the rmetrics API are:

PUBLIC void rmetrics(cchar *message, cchar *namespace, cchar *dimensions, cchar *values, ...);

The message is any identifying message you like to emit. The namespace is the CloudWatch custom namespace name for your metrics.

The metric values are expressed as triples comprised of: Name, Type and Value.

The name is the metric name. The type can be "int", "int64", "boolean" or "string".

You can write multiple metrics with one call by repeating supplying multiple value triples.

The dimensions are vectors that qualify the metric. CloudWatch treats each unique combination of dimensions as a separate metric. Enter the dimensions as a comma separated list of dimensions. For example:

dimensions = "Process,Module"

The values of the dimensions must be added to your value triplets.

1
2
3
4
5
6
rmetrics("Fan Temperature", "Acme/Rocket",
    "InFlowTemp", "int", 101,
    "OutFlowTemp", "int", 143,
    "Process", "int", 42,
    "Module", "string", "input",
    NULL);
}