Monitor, Troubleshoot, and Optimize IoT Solutions
What you must know
Monitoring uses Azure Monitor metrics, diagnostic logs, and IoT Hub metrics such as telemetry messages sent, twin reads, and throttling errors. Know distributed tracing for IoT Edge and the troubleshooting blade for device connectivity. Understand throttling: IoT Hub throttles by SKU and unit count, and the error codes (429, 503) indicate the remedy.
Know device connection state semantics: Connected and Disconnected are not real-time and depend on the heartbeat interval. Know metrics vs. logs: metrics are numeric and near-real-time; logs are detailed and routed to Log Analytics, Storage, or Event Hubs.
Traps
- Treating device connection state as a live presence indicator - it lags by the heartbeat interval.
- Assuming a 429 error means a broken device - it usually means throttling; scale units or reduce frequency.
- Forgetting that diagnostic settings must be enabled before logs appear in Log Analytics.
- Confusing IoT Hub metrics with resource logs; both are needed for full observability.
Rule of thumb
For "device appears offline but is sending data", check the connection state heartbeat before assuming a device fault. For "intermittent 429s", check unit count and message rate before changing code.
Worked example
A solution reports 429 throttling during peak hours. The hub is S1 with 1 unit. Increasing to 3 units raises the per-day message quota and the throttle ceiling, resolving the error without code changes.