in Internet of Things, IoT Hub, Microsoft, Microsoft Azure, Monitoring, Protocols

Timestamps are important for monitoring and testing the IoT messaging flow. In this blog you’ll find which timestamps are available when using Microsoft Azure IoT services.

Within Microsoft Azure, components like IoT Hub, Event Hubs and Stream Analytics are often used in IoT scenarios. Let’s dive into the timestamps for these services. The solution in the diagram is our guide.

Timestamps Azure IoT

In this scenario, a device sends messages to the IoT Hub. The IoT Hub contains an Event Hub that will be used by Stream Analytics to pull messages over. The last component is DocumentDB, to store the messages.

The Timestamps in this scenario:

  1. EnqueuedTime: Date and time the message was received by IoT Hub
  2. EventEnqueuedUtcTime: The date and time that the event was received by Event Hubs
  3. EventProcessedUtcTime: The date and time that the event was processed by Stream Analytics

Source: IoT Hub documentation

Source: Stream Analytics documentation

The message stored in DocumentDB, looks like this:

{
 "EventProcessedUtcTime": "2017-02-28T13:24:27.1803213Z",
 "EventEnqueuedUtcTime": "2017-02-28T13:24:28.1830000Z",
 ...,
 "IoTHub": {
  "EnqueuedTime": "2017-02-28T13:24:26.2410000Z",
  ...,
 }
}

During the scenario, IoT Hub, Event Hubs and Stream Analytics add properties to the message.

 

In some tests, EventProcessedUtcTime was earlier in time than EventEnqueuedUtcTime. The possible explanation for that is:

ASA will visit all partitions from EH, get the data and organize the events into chronological order. This means that data must arrive at all partitions in the EH. I think this will also explain the strange behavior you are seeing with the EventProcessedUtcTime, it might be that because the events are ordered, the logical processing time is before the actual arrival time. Although I’m unsure about this because I do not know the inner workings of ASA

Source: Stackoverflow

 

DocumentDB can be used as input for visualization tools like PowerBI and Web App, to show monitoring and test results.

Write a Comment

Comment