Best Practice 16.2 – Add timestamps to each message published - IoT Lens Checklist

Best Practice 16.2 – Add timestamps to each message published

Timestamps helps in determining delays that might incur during the transmission of a message from the device to the application. Timestamps can be associated to the message and to fields contained in the message. If a timestamp is included, the sent timestamp, along with the sensor or event data, is recorded on the cloud-side.

Recommendation 16.2.1 – Add timestamp on the server side

  • If the devices lack the capability to add timestamps to the messages, consider using server-side features to enrich the messages with timestamps corresponding to the reception of the message.

  • For example, AWS IoT Rules SQL language provides a timestamp() function to generate a timestamp at the reception of the message.

Recommendation 16.2.2 – Have a reliable time source on the device

  • Without a reliable time source, the timestamp can only be used relative to the specific device.

  • For example:

    • Devices should use the Network Time Protocol to obtain a reliable time when connected

    • Real Time Clock devices can be used to maintain an accurate time while the device lacks connectivity

  • Depending on the application, timestamps can be added at the message level or at the single payload field level. Delta encoding can be used to reduce the size of the message when multiple timestamps are included. Choosing the right approach is a trade-off between accuracy, energy efficiency, and payload size.

  • Developer Guide - timestamp()

  • Time series compression algorithms

  • Delta encoding