Skip to content

Commit efd16d8

Browse files
Merge pull request #104162 from KingdomOfEnds/tsi-refresh
TSI Refresh
2 parents 048011f + 6176c31 commit efd16d8

File tree

2 files changed

+63
-25
lines changed

2 files changed

+63
-25
lines changed

articles/time-series-insights/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ metadata:
1313
ms.collection: collection
1414
author: KingdomOfEnds
1515
ms.author: v-adgera
16-
ms.date: 12/17/2019
16+
ms.date: 02/12/2020
1717

1818
landingContent:
1919

articles/time-series-insights/time-series-insights-update-how-to-shape-events.md

Lines changed: 62 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,56 @@ ms.workload: big-data
88
ms.service: time-series-insights
99
services: time-series-insights
1010
ms.topic: conceptual
11-
ms.date: 02/14/2020
11+
ms.date: 02/24/2020
1212
ms.custom: seodec18
1313
---
1414

1515
# Shape events with Azure Time Series Insights Preview
1616

17-
This article helps you shape your JSON file for ingestion and to maximize the efficiency of your Azure Time Series Insights Preview queries.
17+
This article defines best practices to shape your JSON payloads for ingestion in Azure Time Series Insights and to maximize the efficiency of your Preview queries.
1818

1919
## Best practices
2020

21-
Think about how you send events to Time Series Insights Preview. Namely, you should always:
21+
It's best to carefully consider how you send events to your Time Series Insights Preview environment.
22+
23+
General best practices include:
2224

2325
* Send data over the network as efficiently as possible.
2426
* Store your data in a way that helps you aggregate it more suitably for your scenario.
2527

26-
For the best query performance, do the following:
28+
For the best query performance, adhere to the following rules of thumb:
2729

28-
* Don't send unnecessary properties. Time Series Insights Preview bills you on your usage. It's best to store and process the data that you'll query.
29-
* Use instance fields for static data. This practice helps you avoid sending static data over the network. Instance fields, a component of the Time Series Model, work like reference data in the Time Series Insights service that's generally available. To learn more about instance fields, read [Time Series Model](./time-series-insights-update-tsm.md).
30+
* Don't send unnecessary properties. Time Series Insights Preview bills by usage. It's best to store and process only the data that you'll query.
31+
* Use instance fields for static data. This practice helps to avoid sending static data over the network. Instance fields, a component of the Time Series Model, work like reference data in the Time Series Insights service that's generally available. To learn more about instance fields, read [Time Series Model](./time-series-insights-update-tsm.md).
3032
* Share dimension properties among two or more events. This practice helps you send data over the network more efficiently.
3133
* Don't use deep array nesting. Time Series Insights Preview supports up to two levels of nested arrays that contain objects. Time Series Insights Preview flattens arrays in messages into multiple events with property value pairs.
3234
* If only a few measures exist for all or most events, it's better to send these measures as separate properties within the same object. Sending them separately reduces the number of events and might improve query performance because fewer events need to be processed.
3335

34-
During ingestion, payloads that contain nesting will be flattened, such that the column name is a single value with a delineator. Time Series Insights Preview uses underscores for delineation. Note that this is a change from the GA version of the product which used periods. During preview, there is a caveat around flattening, which is illustrated in the second example below.
36+
## Column flattening
37+
38+
During ingestion, payloads that contain nested objects will be flattened so that the column name is a single value with a delineator.
39+
40+
* For example, the following nested JSON:
41+
42+
```JSON
43+
"data": {
44+
"flow": 1.0172575712203979,
45+
},
46+
```
47+
48+
Becomes: `data_flow` when flattened.
3549

36-
## Examples
50+
> [!IMPORTANT]
51+
> * Azure Time Series Insights Preview uses underscores (`_`) for column delineation.
52+
> * Note the difference from General Availability which uses periods (`.`) instead.
3753
38-
The following example is based on a scenario where two or more devices send measurements or signals. The measurements or signals can be *Flow Rate*, *Engine Oil Pressure*, *Temperature*, and *Humidity*.
54+
More complex scenarios are illustrated below.
3955

40-
In the example, there's a single Azure IoT Hub message where the outer array contains a shared section of common dimension values. The outer array uses Time Series Instance data to increase the efficiency of the message.
56+
#### Example 1:
4157

42-
The Time Series Instance contains device metadata. This metadata doesn't change with every event, but it does provide useful properties for data analysis. To save on bytes sent over the wire and make the message more efficient, consider batching common dimension values and using Time Series Instance metadata.
58+
The following scenario has two (or more) devices that send the measurements (signals): *Flow Rate*, *Engine Oil Pressure*, *Temperature*, and *Humidity*.
4359

44-
### Example 1:
60+
There's a single Azure IoT Hub message sent where the outer array contains a shared section of common dimension values (note the two device entries contained in the message).
4561

4662
```JSON
4763
[
@@ -72,10 +88,23 @@ The Time Series Instance contains device metadata. This metadata doesn't change
7288
]
7389
```
7490

75-
### Time Series Instance
91+
**Takeaways:**
92+
93+
* The example JSON has an outer array that uses [Time Series Instance](./time-series-insights-update-tsm.md#time-series-model-instances) data to increase the efficiency of the message. Even though Time Series Instances device metadata's not likely to change, it often provides useful properties for data analysis.
94+
95+
* The JSON combines two or more messages (one from each device) into a single payload saving on bandwidth over time.
96+
97+
* Individual series data points for each device are combined into a single **series** attribute reducing the need to continuously stream updates for each device.
98+
99+
> [!TIP]
100+
> To reduce the number of messages required to send data and make telemetry more efficient, consider batching common dimension values and Time Series Instance metadata into a single JSON payload.
101+
102+
#### Time Series Instance
103+
104+
Let's take a closer look at how to use [Time Series Instance](./time-series-insights-update-tsm.md#time-series-model-instances) to shape your JSON more optimally.
76105

77106
> [!NOTE]
78-
> The Time Series ID is *deviceId*.
107+
> The [Time Series IDs](./time-series-insights-update-how-to-id.md) below are *deviceIds*.
79108
80109
```JSON
81110
[
@@ -110,26 +139,28 @@ The Time Series Instance contains device metadata. This metadata doesn't change
110139
]
111140
```
112141

113-
Time Series Insights Preview joins a table (after flattening) during query time. The table includes additional columns, such as **Type**. The following example demonstrates how you can [shape](./time-series-insights-send-events.md#supported-json-shapes) your telemetry data.
142+
Time Series Insights Preview joins a table (after flattening) during query time. The table includes additional columns, such as **Type**.
114143

115144
| deviceId | Type | L1 | L2 | timestamp | series_Flow Rate ft3/s | series_Engine Oil Pressure psi |
116145
| ---- | ---- | ---- | ---- | ---- | ---- | ---- |
117146
| `FXXX` | Default_Type | SIMULATOR | Battery System | 2018-01-17T01:17:00Z | 1.0172575712203979 | 34.7 |
118147
| `FXXX` | Default_Type | SIMULATOR | Battery System | 2018-01-17T01:17:00Z | 2.445906400680542 | 49.2 |
119148
| `FYYY` | LINE_DATA COMMON | SIMULATOR | Battery System | 2018-01-17T01:18:00Z | 0.58015072345733643 | 22.2 |
120149

121-
In the preceding example, note the following points:
150+
> [!NOTE]
151+
> The preceding table represents the query view in the [Time Series Preview Explorer](./time-series-insights-update-explorer.md).
122152
123-
* Static properties are stored in Time Series Insights Preview to optimize data sent over the network.
153+
**Takeaways:**
154+
155+
* In the preceding example, static properties are stored in Time Series Insights Preview to optimize data sent over the network.
124156
* Time Series Insights Preview data is joined at query time through the Time Series ID that's defined in the instance.
125157
* Two layers of nesting are used. This number is the most that Time Series Insights Preview supports. It's critical to avoid deeply nested arrays.
126158
* Because there are few measures, they're sent as separate properties within the same object. In the example, **series_Flow Rate psi**, **series_Engine Oil Pressure psi**, and **series_Flow Rate ft3/s** are unique columns.
127159

128160
>[!IMPORTANT]
129161
> Instance fields aren't stored with telemetry. They're stored with metadata in the Time Series Model.
130-
> The preceding table represents the query view.
131162
132-
### Example 2:
163+
#### Example 2:
133164

134165
Consider the following JSON:
135166

@@ -143,13 +174,20 @@ Consider the following JSON:
143174
"data_flow" : 1.76435072345733643
144175
}
145176
```
146-
In the example above, the flattened `data_flow` property would present a naming collision with the `data_flow` property. In this case, the *latest* property value would overwrite the earlier one. If this behavior presents a challenge for your business scenarios, please contact the TSI team.
147177

148-
> [!WARNING]
149-
> In cases where duplicate properties are present in the same event payload due to flattening or
150-
> another mechanism, the latest property value is stored, overwritting any previous values.
178+
In the example above, the flattened `data["flow"]` property would present a naming collision with the `data_flow` property.
151179

180+
In this case, the *latest* property value would overwrite the earlier one.
181+
182+
> [!TIP]
183+
> Contact the Time Series Insights team for more assistance!
184+
185+
> [!WARNING]
186+
> * In cases where duplicate properties are present in the same (singular) event payload due to flattening or another mechanism, the latest > property value is stored, over-writing any previous values.
187+
> * Series of combined events will not override one another.
152188
153189
## Next steps
154190

155-
To put these guidelines into practice, read [Azure Time Series Insights Preview query syntax](./time-series-insights-query-data-csharp.md). You'll learn more about the query syntax for the Time Series Insights Preview REST API for data access.
191+
* To put these guidelines into practice, read [Azure Time Series Insights Preview query syntax](./time-series-insights-query-data-csharp.md). You'll learn more about the query syntax for the Time Series Insights [Preview REST API](https://docs.microsoft.com/rest/api/time-series-insights/preview) for data access.
192+
193+
* Combine JSON best practices with [How to Time Series Model](./time-series-insights-update-how-to-tsm.md).

0 commit comments

Comments
 (0)