如何对来自 IOT Central 数据导出、通过事件中心路由并在 TSI 中使用的遥测数据进行类型和建模?

发布于 2025-01-09 07:32:32 字数 842 浏览 4 评论 0原文

使用 IOT Central 数据导出到事件中心时,您的消息格式为:

{
"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"
}

我的问题是如何将遥测属性解压为 TSI 可以视为类型的内容?

类型似乎依赖于更扁平的命名结构,例如 $event.telemety.watts,并且无法查询 $event.telemetrty.label == "watts

我的一个想法是我可能需要在数据到达 TSI 之前,通过使用入站事件中心、然后使用扁平化架构的函数以及 TSI 从中读取的出站事件中心来转换此数据。

When using IOT Central data export to Event Hub, you have a message format which is:

{
"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"
}

My question is how do you unpack the Telemetry property into something which TSI can see as Types?

The Type seems to rely on a flatter naming structure, like $event.telemety.watts, and there is no way to query for $event.telemetrty.label == "watts.

My one thought is that I may need to transform this data before it gets to TSI by using an inbound event hub, then a function to flatten the schema and an outbound event hub which is what TSI reads from.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天煞孤星 2025-01-16 07:32:32

想通了。 IoT Central 数据导出中有一个(对我来说)新的转换功能。

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

遥测:.telemetry |地图({ (.name|tostring): .value }) |添加

Figured it out. There's a new (to me) Transform feature in IoT Central Data Export.

We used the following rule to transform the telemetry.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文