Skip to content

Commit 680eded

Browse files
committed
Line edits
1 parent 5ec0b4c commit 680eded

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/1-introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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.
22

33
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.
44

learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/4-exercise-add-observability-cloud-native-app.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ This step takes several minutes while GitHub creates and configures the codespac
1111
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:
1212

1313
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.
1616
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**.
1818
1. Select **eShopLite - dotnet-observability** from the drop down. Visual Studio Code creates your development container locally.
19+
1920
### Add a diagnostic project to the solution
2021

2122
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.
2223

2324
1. In the Visual Studio Code command palette, enter **>.NET: Open Solution**.
2425
1. Select **dotnet-observability/eShopLite/eShopLite.sln**.
25-
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**.
2627
1. In the **Select a template to create a new .NET project** dialog, select **Class Library (Common, Library)**.
2728
1. In the **Name** field, enter **Diagnostics**.
2829
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.
6970

7071
With the OpenTelemetry packages added, you now introduce the code to make use of them.
7172

72-
1. On the **EXPLORER** pane, right-click the *Class1.cs* file and then select **Rename**.
73+
1. On the **EXPLORER** pane, right-click the *Class1.cs* file, and then select **Rename**.
7374
1. Rename the file to **DiagnosticServiceCollectionExtensions.cs**.
7475
1. Replace the code in the file with the following code:
7576

@@ -140,11 +141,11 @@ With the OpenTelemetry packages added, you now introduce the code to make use of
140141
0 Warning(s)
141142
0 Error(s)
142143
```
143-
144+
144145
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 then select **Add Project Reference**.
146+
1. On the **EXPLORER** pane, under **SOLUTION EXPLORER**, right-click the **Products** project, and then select **Add Project Reference**.
146147
1. Select **Diagnostics**.
147-
1. On the **EXPLORER** pane, expand the *Products* folder and then select **Program.cs**.
148+
1. On the **EXPLORER** pane, expand the *Products* folder, and then select **Program.cs**.
148149
1. Under the code comment `// Add observability code here`, add a call to the Diagnostics method:
149150

150151
```csharp
@@ -197,7 +198,7 @@ With the OpenTelemetry packages added, you now introduce the code to make use of
197198

198199
:::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":::
199200

200-
1. Select **Update Stock** for several of the products. Then, in the dialog, change the stock value and select **Update**.
201+
1. Select **Update Stock** for several of the products. Then, in the dialog, change the stock value, and select **Update**.
201202

202203
1. Select the **TERMINAL** tab and scroll through the messages. Note there are messages from OpenTelemetry like:
203204

learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/5-view-telemetry-data.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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.
22

33
## Monitor and view telemetry data
44

55
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.
66

77
### Prometheus
88

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.
1010

1111
:::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":::
1212

@@ -29,7 +29,7 @@ scrape_configs:
2929
3030
### Grafana
3131
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.
3333
3434
:::image type="content" source="../media/grafana.png" alt-text="Screenshot that shows an ASP.NET dashboard in Grafana." lightbox="../media/grafana.png":::
3535
@@ -57,8 +57,8 @@ In your diagnostics project, you need to add support for Zipkin via the `OpenTel
5757

5858
### Go deeper with Application Insights
5959

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.
6161

6262
:::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":::
6363

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.

learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/6-exercise-use-opentelemetry-data-cloud-native-application.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff 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.
22

33
## Add Prometheus and Grafana
44

@@ -38,9 +38,9 @@ The preceding Docker yaml adds two new services, **Prometheus** and **Grafana**.
3838
3939
Prometheus needs to be configured so that it knows where to collect the metrics. You add a *prometheus.yml* file to the *prometheus* folder.
4040
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**.
4444
1. In the name field, enter **prometheus.yml**.
4545
1. In the file editor, enter this YAML:
4646
@@ -67,9 +67,9 @@ Grafana needs to be configured so that it knows where to collect the metrics.
6767
6868
1. In Visual Studio Code, on the **EXPLORER** pane, right-click the *dotnet-observability* folder and then select **New Folder**.
6969
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**.
7171
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**.
7373
1. In the name field, enter **dashboard**.
7474
1. Expand the *grafana* folder, right-click the *datasource* folder, and then select **New File**.
7575
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
115115
dotnet add package OpenTelemetry.Exporter.Prometheus.AspNetCore --prerelease
116116
```
117117

118-
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**.
119119
1. Replace the console exporter `.AddConsoleExporter();` with this code:
120120

121121
```csharp
@@ -139,9 +139,9 @@ Now, the diagnostics project is only configured to expose metrics to the console
139139

140140
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.
141141

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**.
143143
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**.
145145
1. Under the code comment `// Add observability code here`, add a call to the Diagnostics method:
146146

147147
```csharp
@@ -185,7 +185,6 @@ You now test the new observability features you added to the app.
185185
```dotnetcli
186186
dotnet publish /p:PublishProfile=DefaultContainer
187187
```
188-
189188

190189
1. Go to the *dotnet-observability* folder, and start the app with Docker:
191190

@@ -222,7 +221,7 @@ You now test the new observability features you added to the app.
222221

223222
## Add Zipkin
224223

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.
226225

227226
1. In Visual Studio Code, on the **EXPLORER** pane, select the *docker-compose.yml* file inside the *dotnet-observability* folder.
228227

@@ -306,7 +305,7 @@ You now extend the tracing capabilities of the app by adding Zipkin. As you did
306305
dotnet add package OpenTelemetry.Exporter.Zipkin --prerelease
307306
```
308307

309-
1. On the **EXPLORER** pane, expand the *Diagnostics* folder and then select **DiagnosticServiceCollectionExtensions.cs**.
308+
1. On the **EXPLORER** pane, expand the *Diagnostics* folder, and then select **DiagnosticServiceCollectionExtensions.cs**.
310309
1. At the bottom of the tracing providers, add Zipkin:
311310

312311
```csharp

learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/7-exercise-extend-telemetry.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ You want to have greater visibility of how a stock changes over time, so you cre
5050
This code adds the `ProductsMetrics` class to the dependency injection container.
5151

5252
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**.
5454
1. Replace the existing stock update `MapPut` endpoint with this code:
5555

5656
```csharp
@@ -128,12 +128,12 @@ You now add the metric to OpenTelemetry so that it can be exported to your obser
128128
1. Open the **:::no-loc text="eShopLite":::** app in a browser at `http://localhost:32000`.
129129
1. Go to the **Products** page and change the stock amount on several products.
130130
1. Open the **Prometheus** dashboard at `http://localhost:9090`.
131-
1. In the search box, enter the`eshoplite_products_stock_change_total` metric and then select **Execute**.
131+
1. In the search box, enter the`eshoplite_products_stock_change_total` metric, and then select **Execute**.
132132

133133
You should see it listed in a table.
134134

135135
1. Select the **Graph** tab. You should see the stock amount change over time.
136136

137137
:::image type="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":::
138138

139-
1. On the **TERMINAL** pane, press <kbd>Ctrl</kbd>+<kbd>C</kbd> to stop the app.
139+
1. On the **TERMINAL** pane, press <kbd>Ctrl</kbd>+<kbd>C</kbd> to stop the app.

learn-pr/aspnetcore/implement-observability-cloud-native-app-with-opentelemetry/includes/9-summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ In most cloud-native applications, it's critical to generate telemetry data that
22

33
## Clean up codespace
44

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

Comments
 (0)