You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/1-introduction.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
Because of the distributed nature of cloud-native applications, they should be closely monitored to ensure they're healthy and that their behavior is fast and reliable. If problems develop, you need to know before users do. You can achieve observability by including a telemetry package such as OpenTelemetry.
1
+
Because of the distributed nature of cloud-native applications, they should be closely monitored to ensure they're healthy, and their behavior is fast and reliable. If problems develop, you need to know before users do. You can achieve observability by including a telemetry package such as OpenTelemetry.
2
2
3
3
Imagine you work for an online outdoor clothing retailer that has a microservice-based web app it uses for stock management. While testing the cloud-native app, you're asked to ensure that its behavior can be monitored. You want to see how .NET supports observability.
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/4-exercise-add-observability-cloud-native-app.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,18 +11,19 @@ This step takes several minutes while GitHub creates and configures the codespac
11
11
To use **Visual Studio Code**, clone the [https://github.com/MicrosoftDocs/mslearn-dotnet-cloudnative](https://github.com/MicrosoftDocs/mslearn-dotnet-cloudnative) repository to your local machine. Then:
12
12
13
13
1. Install any [system requiements](https://code.visualstudio.com/docs/devcontainers/containers) to run Dev Container in Visual Studio Code.
14
-
1. Make sure Docker is running.
15
-
1. In a new Visual Studio Code window open the folder of the cloned repository
14
+
1. Make sure Docker is running.
15
+
1. In a new Visual Studio Code window open the folder of the cloned repository.
16
16
1. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> to open the command palette.
17
-
1. Search: **>Dev Containers: Rebuild and Reopen in Container**
17
+
1. Search: **>Dev Containers: Rebuild and Reopen in Container**.
18
18
1. Select **eShopLite - dotnet-observability** from the drop down. Visual Studio Code creates your development container locally.
19
+
19
20
### Add a diagnostic project to the solution
20
21
21
22
The first step to adding observability to the **:::no-loc text="eShopLite":::** app is to introduce a new diagnostic project to the solution. This project contains all the OpenTelemetry packages and configurations that you'll use to add observability to the app.
22
23
23
24
1. In the Visual Studio Code command palette, enter **>.NET: Open Solution**.
1. In the **Solution Explorer**, at the bottom of the **EXPLORER** pane, right-click the **eShopLite** solution and then select **New Project**.
26
+
1. In the **Solution Explorer**, at the bottom of the **EXPLORER** pane, right-click the **eShopLite** solution, and then select **New Project**.
26
27
1. In the **Select a template to create a new .NET project** dialog, select **Class Library (Common, Library)**.
27
28
1. In the **Name** field, enter **Diagnostics**.
28
29
1. In the **Project will be created in** dropdown, select **Default directory**.
@@ -69,7 +70,7 @@ Now add the OpenTelemetry packages to the new diagnostic project.
69
70
70
71
With the OpenTelemetry packages added, you now introduce the code to make use of them.
71
72
72
-
1. On the **EXPLORER** pane, right-click the *Class1.cs* file and thenselect**Rename**.
73
+
1. On the **EXPLORER** pane, right-click the *Class1.cs* file, and thenselect**Rename**.
73
74
1. Rename the file to **DiagnosticServiceCollectionExtensions.cs**.
74
75
1. Replace the code in the file with the following code:
75
76
@@ -140,11 +141,11 @@ With the OpenTelemetry packages added, you now introduce the code to make use of
140
141
0 Warning(s)
141
142
0 Error(s)
142
143
```
143
-
144
+
144
145
1. The **Diagnostics** project is now ready to be used by the **Products** service.
145
-
1. On the **EXPLORER** pane, under **SOLUTION EXPLORER**, right-click the **Products** project and thenselect**Add Project Reference**.
146
+
1. On the **EXPLORER** pane, under **SOLUTION EXPLORER**, right-click the **Products** project, and thenselect**Add Project Reference**.
146
147
1. Select **Diagnostics**.
147
-
1. On the **EXPLORER** pane, expand the *Products* folder and thenselect**Program.cs**.
148
+
1. On the **EXPLORER** pane, expand the *Products* folder, and thenselect**Program.cs**.
148
149
1. Under the code comment `// Add observability code here`, add a call to the Diagnostics method:
149
150
150
151
```csharp
@@ -197,7 +198,7 @@ With the OpenTelemetry packages added, you now introduce the code to make use of
197
198
198
199
:::image type="content" source="../media/eshoplite-products.png" alt-text="A screenshot that shows the Products page in the eShopLite app. The page shows a list of products with a name, description, and price and a button to update the stock." lightbox="../media/eshoplite-products.png":::
199
200
200
-
1. Select **Update Stock**forseveral of the products. Then,in the dialog, change the stock value and select**Update**.
201
+
1. Select **Update Stock**forseveral of the products. Then,in the dialog, change the stock value, and select**Update**.
201
202
202
203
1. Select the **TERMINAL** tab and scroll through the messages. Note there are messages from OpenTelemetry like:
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/5-view-telemetry-data.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
Your app is collecting telemetry data and you now need a more comprehensive way to view it. In this unit, you'll see how to view telemetry data in many different tools.
1
+
Your app is collecting telemetry data, and you now need a more comprehensive way to view it. In this unit, you'll see how to view telemetry data in many different tools.
2
2
3
3
## Monitor and view telemetry data
4
4
5
5
A common way to view telemetry data is to use Prometheus and Grafana together. Prometheus is an open-source monitoring system that collects metrics from your cloud-native app. Grafana is an open-source visualization tool that you use to create dashboards to view the metrics collected by Prometheus.
6
6
7
7
### Prometheus
8
8
9
-
The first step is to add a Prometheus container and configure it to collect data from each microservice in your app. You then add the Prometheus .NET client library to collect metrics from the app.
9
+
The first step is to add a Prometheus container, and configure it to collect data from each microservice in your app. You then add the Prometheus .NET client library to collect metrics from the app.
10
10
11
11
:::image type="content" source="../media/prometheus.png" alt-text="Screenshot that shows the configured Prometheus app showing the health of the eShopLite app." lightbox="../media/prometheus.png":::
12
12
@@ -29,7 +29,7 @@ scrape_configs:
29
29
30
30
### Grafana
31
31
32
-
Grafana is an open-source visualization tool that you can use to create dashboards to view the metrics collected by Prometheus. You can configure Grafana to connect to Prometheus and display the metrics in a dashboard. Like before, you add a Grafana container to your app and configure it to connect to Prometheus.
32
+
Grafana is an open-source visualization tool that you can use to create dashboards to view the metrics collected by Prometheus. You can configure Grafana to connect to Prometheus, and display the metrics in a dashboard. Like before, you add a Grafana container to your app, and configure it to connect to Prometheus.
33
33
34
34
:::image type="content" source="../media/grafana.png" alt-text="Screenshot that shows an ASP.NET dashboard in Grafana." lightbox="../media/grafana.png":::
35
35
@@ -57,8 +57,8 @@ In your diagnostics project, you need to add support for Zipkin via the `OpenTel
57
57
58
58
### Go deeper with Application Insights
59
59
60
-
There's a tool that can combine looking at metrics and viewing distributed tracing and then merge it with data from logs. Application Insights is an extensible Application Performance Management (APM) service. You can use it to monitor your live web application. Application Insights automatically detects performance anomalies. It includes powerful analytics tools to help you diagnose issues and understand what users actually do with your app.
60
+
There's a tool that can combine looking at metrics and viewing distributed tracing, and then merge it with data from logs. Application Insights is an extensible Application Performance Management (APM) service. You can use it to monitor your live web application. Application Insights automatically detects performance anomalies. It includes powerful analytics tools to help you diagnose issues and understand what users actually do with your app.
61
61
62
62
:::image type="content" source="../media/app-insights.png" alt-text="Screenshot that shows Application Insights showing the health of the eShopLite app." lightbox="../media/app-insights.png":::
63
63
64
-
Like the preceding tools, you need to add a NuGet package to your solution `Azure.Monitor.OpenTelemetry.AspNetCore` and then introduce Azure Monitor as an exporter to your diagnostics project.
64
+
Like the preceding tools, you need to add a NuGet package to your solution `Azure.Monitor.OpenTelemetry.AspNetCore`, and then introduce Azure Monitor as an exporter to your diagnostics project.
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/6-exercise-use-opentelemetry-data-cloud-native-application.md
+11-12Lines changed: 11 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
In this exercise, you get better visibility of all the data generated by OpenTelemetry in your app. You finish adding diagnostics capability to the Store service. With that in place, you add Prometheus and Grafana to the **:::no-loc text="eShopLite":::** services and look at some of the metrics being captured. The next step is to add Zipkin and view the distributed traces. Finally, you add Application Insights to your app and use it to view the data.
1
+
In this exercise, you get better visibility of all the data generated by OpenTelemetry in your app. You finish adding diagnostics capability to the Store service. With that in place, you add Prometheus and Grafana to the **:::no-loc text="eShopLite":::** services and look at some of the metrics being captured. The next step is to add Zipkin and view the distributed traces. Finally, you add Application Insights to your app, and use it to view the data.
2
2
3
3
## Add Prometheus and Grafana
4
4
@@ -38,9 +38,9 @@ The preceding Docker yaml adds two new services, **Prometheus** and **Grafana**.
38
38
39
39
Prometheus needs to be configured so that it knows where to collect the metrics. You add a *prometheus.yml* file to the *prometheus* folder.
40
40
41
-
1. In Visual Studio Code, on the **EXPLORER** pane, right-click the *dotnet-observability* folder and then select **New Folder**.
42
-
1. In the name field, enter<!--CE:Please check: Should 'prometheus' be capitalized here and in steps 3 and 4?--> **prometheus**.
43
-
1. On the **EXPLORER** pane, right-click the *prometheus* folder and then select **New File**.
41
+
1. In Visual Studio Code, on the **EXPLORER** pane, right-click the *dotnet-observability* folder, and then select **New Folder**.
42
+
1. In the name field, enter **prometheus**.
43
+
1. On the **EXPLORER** pane, right-click the *prometheus* folder, and then select **New File**.
44
44
1. In the name field, enter **prometheus.yml**.
45
45
1. In the file editor, enter this YAML:
46
46
@@ -67,9 +67,9 @@ Grafana needs to be configured so that it knows where to collect the metrics.
67
67
68
68
1. In Visual Studio Code, on the **EXPLORER** pane, right-click the *dotnet-observability* folder and then select **New Folder**.
69
69
1. In the name field, enter **grafana**.
70
-
1. Right-click the *grafana* folder and then select **New Folder**.
70
+
1. Right-click the *grafana* folder, and then select **New Folder**.
71
71
1. In the name field, enter **datasource**.
72
-
1. Right-click the *grafana* folder and then select **New Folder**.
72
+
1. Right-click the *grafana* folder, and then select **New Folder**.
73
73
1. In the name field, enter **dashboard**.
74
74
1. Expand the *grafana* folder, right-click the *datasource* folder, and then select **New File**.
75
75
1. In the name field, enter **datasource.yml**.
@@ -115,7 +115,7 @@ Now, the diagnostics project is only configured to expose metrics to the console
1. On the **EXPLORER** pane, expand the *Diagnostics* folder and then select **DiagnosticServiceCollectionExtensions.cs**.
118
+
1. On the **EXPLORER** pane, expand the *Diagnostics* folder, and then select **DiagnosticServiceCollectionExtensions.cs**.
119
119
1. Replace the console exporter `.AddConsoleExporter();` with this code:
120
120
121
121
```csharp
@@ -139,9 +139,9 @@ Now, the diagnostics project is only configured to expose metrics to the console
139
139
140
140
The app is currently only configured to expose metrics for the **Products** service. You update the app to expose metrics for the **Store** service too.
141
141
142
-
1. On the **EXPLORER** pane, under **SOLUTION EXPLORER**, right-click the **Store** project and then select **Add Project Reference**.
142
+
1. On the **EXPLORER** pane, under **SOLUTION EXPLORER**, right-click the **Store** project, and then select **Add Project Reference**.
143
143
1. Select **Diagnostics**.
144
-
1. On the **EXPLORER** pane, expand the *Store* folder and then select **Program.cs**.
144
+
1. On the **EXPLORER** pane, expand the *Store* folder, and then select **Program.cs**.
145
145
1. Under the code comment `// Add observability code here`, add a call to the Diagnostics method:
146
146
147
147
```csharp
@@ -185,7 +185,6 @@ You now test the new observability features you added to the app.
185
185
```dotnetcli
186
186
dotnet publish /p:PublishProfile=DefaultContainer
187
187
```
188
-
189
188
190
189
1. Go to the *dotnet-observability* folder, and start the app with Docker:
191
190
@@ -222,7 +221,7 @@ You now test the new observability features you added to the app.
222
221
223
222
## Add Zipkin
224
223
225
-
You now extend the tracing capabilities of the app by adding Zipkin. As you did before, you add a Zipkin container to your app and configure it to connect to the OpenTelemetry collector. Then you add the OpenTelemetry Zipkin exporter to your app.
224
+
You now extend the tracing capabilities of the app by adding Zipkin. As you did before, you add a Zipkin container to your app, and configure it to connect to the OpenTelemetry collector. Then you add the OpenTelemetry Zipkin exporter to your app.
226
225
227
226
1. In Visual Studio Code, on the **EXPLORER** pane, select the *docker-compose.yml* file inside the *dotnet-observability* folder.
228
227
@@ -306,7 +305,7 @@ You now extend the tracing capabilities of the app by adding Zipkin. As you did
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/7-exercise-extend-telemetry.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ You want to have greater visibility of how a stock changes over time, so you cre
50
50
Thiscodeaddsthe `ProductsMetrics` classto the dependency injection container.
51
51
52
52
1. Select <kbd>Ctrl</kbd>+<kbd>S</kbd> to save the file.
53
-
1. On the **EXPLORER** pane, in the *Products* folder, expand the *Endpoint* folder and then select **ProductEndpoints.cs**.
53
+
1. On the **EXPLORER** pane, in the *Products* folder, expand the *Endpoint* folder, and then select **ProductEndpoints.cs**.
54
54
1. Replace the existing stock update `MapPut` endpoint with this code:
55
55
56
56
```csharp
@@ -128,12 +128,12 @@ You now add the metric to OpenTelemetry so that it can be exported to your obser
:::imagetype="content"source="../media/new-metric.png"alt-text="Screenshot that shows Prometheus showing the new custom metric on a graph."lightbox="../media/new-metric.png":::
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/9-summary.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,4 +2,4 @@ In most cloud-native applications, it's critical to generate telemetry data that
2
2
3
3
## Clean up codespace
4
4
5
-
You can delete the codespace on [GitHub](https://github.com/codespaces) under **By repository** where you see *MicrosoftDocs/mslearn-dotnet-cloudnative*.
5
+
You can delete the codespace on [GitHub](https://github.com/codespaces) under **By repository** where you see *MicrosoftDocs/mslearn-dotnet-cloudnative*.
0 commit comments