I am performing a GET every minute on the below URL to obtain Device State for all Devices in my IOT Registry
GET https://cloudiot.googleapis.com/v1/{name=projects/*/locations/*/registries/*/devices/*}
Once I obtain a Device, I am interested in determining if the following fields are within the last minute of the current timestamp:
"lastHeartbeatTime": string
"lastStateTime": string
"lastEventTime": string
My devices are frequently pinging the remote broker, with a MQTT Keep Alive time of 10s, so I assume that's 6 heartbeats in a minute at most.
The idea is that I'd like to gather per Device statistics for Availability and Uptime metrics as well as Alerting.
All of this works, but I have a suspicion that the Google backend doesn't update the heartbeat, event and state timestamps frequently enough, sometimes leading the above setup to record stats that my devices are not up, when in fact they are.
My questions are:
How quickly are my device heartbeat times updated in the Device state? Is a minute too short?
Would you recommend a better way to achieve the above? What does that entail?