0

使用 IOT Central 数据导出到 Event Hub 时,您的消息格式为:

{
"applicationId": "A-GUID",
"component": null,
"deviceId": "AN-ID",
"enqueuedTime": "2022-02-23T20:34:11.0400000Z",
"enrichments": {},
"messageProperties": {},
"messageSource": "telemetry",
"module": null,
"schema": "default@v1",
"telemetry": [
{
"label": "temp",
"value": "33"
},
{
"label": "watts",
"value": 2183
}
...
"templateId": "A-TEMPLATE-ID",
"ts": "2022-02-23T20:26:39.0000000Z",
"EventProcessedUtcTime": "2022-02-23T20:37:53.1779856Z",
"PartitionId": 0,
"EventEnqueuedUtcTime": "2022-02-23T20:34:12.5810000Z"
}

我的问题是如何将 Telemetry 属性解压缩为 TSI 可以视为类型的东西?

Type 似乎依赖于更扁平的命名结构,比如$event.telemety.watts,没有办法查询$event.telemetrty.label == "watts.

我的一个想法是,我可能需要在数据到达 TSI 之前先转换这些数据,方法是使用入站事件中心、展平架构的函数和 TSI 读取的出站事件中心。

4

1 回答 1

0

弄清楚了。IoT Central 数据导出中有一个新的(对我而言)转换功能。

我们使用以下规则来转换遥测。

telemetry: .telemetry | map({ (.name|tostring): .value }) | add

于 2022-02-23T23:08:59.513 回答