|
1 | 1 | ---
|
2 |
| -title: Add correlation IDs to IoT messages with distributed tracing (preview) |
| 2 | +title: Monitor IoT messages with distributed tracing (preview) |
| 3 | +titleSuffix: Azure IoT Hub |
3 | 4 | description: Learn how to use distributed tracing to trace IoT messages throughout the Azure services that your solution uses.
|
4 | 5 | author: kgremban
|
5 | 6 |
|
6 | 7 | ms.author: kgremban
|
7 | 8 | ms.service: iot-hub
|
8 | 9 | ms.topic: how-to
|
9 |
| -ms.date: 01/26/2022 |
10 |
| -ms.custom: [amqp, mqtt, fasttrack-edit, iot] |
| 10 | +ms.date: 02/29/2024 |
| 11 | +ms.custom: [amqp, mqtt, fasttrack-edit, references_regions] |
11 | 12 | ---
|
12 | 13 |
|
13 | 14 | # Trace Azure IoT device-to-cloud messages by using distributed tracing (preview)
|
14 | 15 |
|
15 |
| -IoT Hub is one of the first Azure services to support distributed tracing. As more Azure services support distributed tracing, you're able to trace Internet of Things (IoT) messages throughout the Azure services involved in your solution. For a background on the feature, see [What is distributed tracing?](../azure-monitor/app/distributed-tracing-telemetry-correlation.md). |
| 16 | +Use distributed tracing (preview) in IoT Hub to monitor IoT messages as they pass through Azure services. IoT Hub is one of the first Azure services to support distributed tracing. As more Azure services support distributed tracing, you're able to trace Internet of Things (IoT) messages throughout the Azure services involved in your solution. For more information about the feature, see [What is distributed tracing?](../azure-monitor/app/distributed-trace-data.md). |
16 | 17 |
|
17 | 18 | When you enable distributed tracing for IoT Hub, you can:
|
18 | 19 |
|
@@ -126,44 +127,38 @@ You can use the Azure portal or the Azure IoT Hub extension for Visual Studio Co
|
126 | 127 | 1. Select the gear icon under **Distributed Tracing (preview)**. In the panel that opens:
|
127 | 128 |
|
128 | 129 | 1. Select the **Enable** option.
|
129 |
| - 1. For **Sampling rate**, choose a percentage between 0 and 100. |
| 130 | + 1. For **Sampling rate**, choose a percentage between 0 and 100. |
130 | 131 | 1. Select **Save**.
|
131 | 132 |
|
132 | 133 | :::image type="content" source="media/iot-hub-distributed-tracing/enable-distributed-tracing.png" alt-text="Screenshot that shows how to enable distributed tracing in the Azure portal." lightbox="media/iot-hub-distributed-tracing/enable-distributed-tracing.png":::
|
133 | 134 |
|
134 | 135 | 1. Wait a few seconds, and then select **Refresh**. If the device successfully acknowledges your changes, a sync icon with a check mark appears.
|
135 | 136 |
|
136 |
| -1. Go back to the console window for the telemetry message app. Confirm that messages are being sent with `tracestate` in the application properties. |
137 |
| - |
138 |
| - :::image type="content" source="media/iot-hub-distributed-tracing/MicrosoftTeams-image.png" alt-text="Screenshot that shows trace state messages." lightbox="media/iot-hub-distributed-tracing/MicrosoftTeams-image.png"::: |
139 |
| - |
140 |
| -1. (Optional) Change the sampling rate to a different value, and observe the change in frequency that messages include `tracestate` in the application properties. |
141 |
| - |
142 | 137 | #### [VS Code](#tab/vscode)
|
143 | 138 |
|
144 | 139 | 1. With Visual Studio Code installed, install the latest version of the [Azure IoT Hub extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit).
|
145 | 140 |
|
146 |
| -1. Open Visual Studio Code, and go to the **Explorer** tab and the **Azure IoT Hub** section. |
| 141 | +1. Open Visual Studio Code, and go to the **Explorer** tab and the **Azure IoT Hub** section. |
147 | 142 |
|
148 |
| -1. Select the ellipsis (...) next to **Azure IoT Hub** to see a submenu. Choose the **Select IoT Hub** option to retrieve your IoT hub from Azure. |
| 143 | +1. Select the ellipsis (...) next to **Azure IoT Hub** to see a submenu. Choose the **Select IoT Hub** option to retrieve your IoT hub from Azure. |
149 | 144 |
|
150 | 145 | In the pop-up window that appears at the top of Visual Studio Code, you can select your subscription and IoT hub.
|
151 | 146 |
|
152 | 147 | See a demonstration on the [vscode-azure-iot-toolkit](https://github.com/Microsoft/vscode-azure-iot-toolkit/wiki/Select-IoT-Hub) GitHub page.
|
153 | 148 |
|
154 |
| -1. Expand your device under **Devices**. Right-click **Distributed Tracing Setting (Preview)**, and then select **Update Distributed Tracing Setting (Preview)**. |
| 149 | +1. Expand your device under **Devices**. Right-click **Distributed Tracing Setting (Preview)**, and then select **Update Distributed Tracing Setting (Preview)**. |
155 | 150 |
|
156 |
| -1. In the pop-up pane that appears at the top of the window, select **Enable**. |
| 151 | +1. In the pop-up pane that appears at the top of the window, select **Enable**. |
157 | 152 |
|
158 | 153 | :::image type="content" source="media/iot-hub-distributed-tracing/enable-distributed-tracing-vsc.png" alt-text="Screenshot that shows how to enable distributed tracing in the Azure IoT Hub extension.":::
|
159 | 154 |
|
160 | 155 | **Enable Distributed Tracing: Enabled** now appears under **Distributed Tracing Setting (Preview)** > **Desired**.
|
161 | 156 |
|
162 |
| -1. In the pop-up pane that appears for the sampling rate, enter **100** and then select the Enter key. |
| 157 | +1. In the pop-up pane that appears for the sampling rate, enter an integer between 0 and 100, then select the Enter key. |
163 | 158 |
|
164 | 159 | 
|
165 | 160 |
|
166 |
| - **Sample rate: 100(%)** now also appears under **Distributed Tracing Setting (Preview)** > **Desired**. |
| 161 | + **Sample rate: 100(%)** now appears under **Distributed Tracing Setting (Preview)** > **Desired**. |
167 | 162 |
|
168 | 163 | ---
|
169 | 164 |
|
@@ -300,7 +295,7 @@ In this section, you edit the [iothub_ll_telemetry_sample.c](https://github.com/
|
300 | 295 |
|
301 | 296 | 1. Keep the app running. You can observe the messages being sent to IoT Hub in the console window.
|
302 | 297 |
|
303 |
| -For a client app that can receive sampling decisions from the cloud, try the [iothub_devicetwin_sample.c](https://aka.ms/iottracingCsample) sample in the distributed tracing sample repo. |
| 298 | +For a client app that can receive sampling decisions from the cloud, try the [iothub_devicetwin_sample.c](https://github.com/Azure-Samples/azure-iot-distributed-tracing-sample/tree/master/iothub_devicetwin_sample-c) sample in the distributed tracing sample repo. |
304 | 299 |
|
305 | 300 | ### Workaround for non-Microsoft clients
|
306 | 301 |
|
|
0 commit comments