In my current Azure IoT hub solution, I'm using D2C/C2D messages, device twins and file upload.
I had a look at my total metered messages per day (dailyMessageQuotaUsed
) and was a bit surprised, because the numbers were higher than expected (~10k per day).
Then I had a look at my d2c/c2d messages (~100-350 per day)
And my device twin reads/writes from device (~500 per day)
And my file uploads (~4k per day)
Query used:
AzureDiagnostics
| where ResourceType == "IOTHUBS" and Category == "FileUploadOperations"
| where TimeGenerated > ago(30d)
| extend p=parse_json(properties_s)
| where p.fileUploadStatusCode == 201
| summarize count() by bin(TimeGenerated, 1d)
My assumption now is:
2 messages per file upload (initiate, finished)
+ 2 messages per twin operation (request/response)
+ d2c/c2d messages
=> 2*4500 + 2*500 + 300 = 10300
d2c.telemetry.ingress.success
and c2d.commands.egress.complete.success
metrics the number of metered messages (per 4k) or sent messages (per send)? I couldn't figure it out while reading the documentationIs my assumption correct?
Is partially correct.
2 messages per file upload (initiate, finished)
This is correct and aligns with Pricing Documentation:
Only the messages which initiate a new upload and provide notification of a completed upload count against the daily allotment of messages... in a typical file upload scenario, there are only two messages...
+ 2 messages per twin operation (request/response)
It depends. Not always will be 2 messages count. Twin reads, writes, and queries are metered in 4-KB chunks.
+ d2c/c2d messages
Only if they are sent separately and you are not using Batching to merge information from multiple messages into a single batch of messages. See Benefits of using the Azure IoT SDKs, and pitfalls to avoid if you don’t to learn how to use Batching out-of-the-box when using azure iot sdks.
Is there a built-in feature that allows me to see the total metered messages split by their message type (d2c/c2d/twin/file/...) or is my approach the best one possible?
Your approach looks to be the most accurate one as of today.
Are the d2c.telemetry.ingress.success and c2d.commands.egress.complete.success metrics the number of metered messages (per 4k) or sent messages (per send)?
Those metrics represent number of 4k messages sent\received.