Skip to content

Commit 534f4df

Browse files
authored
Merge pull request #50599 from ShawnKupfer/WB1799
AB#1055036: Use telemetry in a .NET Aspire project
2 parents 924f54d + 9a5045f commit 534f4df

16 files changed

+48
-48
lines changed

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/1-introduction.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
author: camsoper
88
ms.author: casoper
99
ms.topic: unit
10-
ms.date: 8/20/2024
10+
ms.date: 05/21/2025
1111
ms.custom: devx-track-dotnet
1212
durationInMinutes: 1
1313
content: |

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/2-telemetry-apis-dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
description: In this unit, you'll learn about the different sources of telemetry data in .NET.
77
author: camsoper
88
ms.author: casoper
9-
ms.date: 8/20/2024
9+
ms.date: 05/21/2025
1010
ms.topic: unit
1111
ms.custom: devx-track-dotnet
1212
durationInMinutes: 7

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/3-telemetry-dotnet-aspire.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
description: In this unit, you'll learn how to use OpenTelemetry APIs to instrument a microservice in a .NET Aspire cloud-native app.
77
author: camsoper
88
ms.author: casoper
9-
ms.date: 8/20/2024
9+
ms.date: 05/21/2025
1010
ms.topic: unit
1111
ms.custom: devx-track-dotnet
1212
durationInMinutes: 7

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/4-dotnet-aspire-dashboard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
author: camsoper
88
ms.author: casoper
99
ms.topic: unit
10-
ms.date: 8/20/2024
10+
ms.date: 05/21/2025
1111
ms.custom: devx-track-dotnet
1212
durationInMinutes: 7
1313
content: |

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/5-ilogger-custom-log-messages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
description: In this unit, you'll learn how to add messages to structured logs by using a logger object.
77
author: camsoper
88
ms.author: casoper
9-
ms.date: 8/20/2024
9+
ms.date: 05/21/2025
1010
ms.topic: unit
1111
durationInMinutes: 5
1212
content: |

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/6-exercise-use-telemetry-dotnet-aspire.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
description: In this unit, you'll instrument a .NET Aspire cloud-native app and examine the data it emits in the dashboard.
77
author: camsoper
88
ms.author: casoper
9-
ms.date: 8/20/2024
9+
ms.date: 05/21/2025
1010
ms.topic: unit
1111
ms.custom: devx-track-dotnet
1212
durationInMinutes: 10

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/7-knowledge-check.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ metadata:
66
description: "In this unit, you'll answer questions about telemetry in .NET Aspire to check the knowledge you've gained in this module."
77
author: camsoper
88
ms.author: casoper
9-
ms.date: 8/20/2024
9+
ms.date: 05/21/2025
1010
ms.topic: unit
1111
ms.custom: team=cloud_advocates, devx-track-dotnet
1212
durationInMinutes: 5
1313
content: |
1414
quiz:
1515
questions:
16-
- content: "You have deployed your cloud-native app to production. Some users are complaining that the product catalog is slow to load. You want to see how request durations vary over time. Which type of telemetry should you use?"
16+
- content: "You deployed your cloud-native app to production. Some users are complaining that the product catalog is slow to load. You want to see how request durations vary over time. Which type of telemetry should you use?"
1717
choices:
1818
- content: "Logs"
1919
isCorrect: false
20-
explanation: "Incorrect. Logs provided a timestamped record of what happened, but it's not straight forward to display visually how durations vary."
20+
explanation: "Incorrect. Logs provide a timestamped record of what happened, but it's not straightforward to display visually how durations vary."
2121
- content: "Metrics"
2222
isCorrect: true
2323
explanation: "Correct. By using the request duration counter, you can display a graph in the .NET Aspire dashboard that shows how durations vary over various time periods."
2424
- content: "Distributed traces"
2525
isCorrect: false
26-
explanation: "Incorrect. Distributed traces can show the duration of a single request but it's not straight forward to display visually how durations vary."
26+
explanation: "Incorrect. Distributed traces can show the duration of a single request, but it's not straightforward to display visually how durations vary."
2727
- content: "You're troubleshooting an issue with a microservice, which is experiencing crashes. Which type of telemetry should you use?"
2828
choices:
2929
- content: "Logs"

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/8-summary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
description: In this unit, you'll review what you've learned about telemetry in .NET Aspire cloud-native applications.
77
author: camsoper
88
ms.author: casoper
9-
ms.date: 8/20/2024
9+
ms.date: 05/21/2025
1010
ms.topic: unit
1111
ms.custom: devx-track-dotnet
1212
durationInMinutes: 5

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/includes/1-introduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
Cloud-native applications consist of independent microservices that may execute as a distributed set of containers. It can be difficult to study the behavior of the entire application to diagnose bugs or performance issues. You should consider early how to record telemetry data. .NET Aspire provides a dashboard that displays telemetry in a developer focused view.
2-
1+
Cloud-native applications consist of independent microservices that may execute as a distributed set of containers. It can be difficult to study the entire application's behavior to diagnose bugs or performance issues. You should consider early how to record telemetry data. .NET Aspire provides a dashboard that displays telemetry in a developer focused view.
2+
33
Imagine you're an employee at an outdoor equipment retailer. You've started to build your new cloud-native app and you've integrated .NET Aspire to manage and connect your microservices. Now, you want to study the performance of the microservices and obtain details when bugs arise in your code.
44

5-
In this module, you'll see how .NET Aspire makes it easy to both record and examine telemetry in a cloud-native app.
5+
In this module, you'll learn how .NET Aspire makes it easy to both record and examine telemetry in a cloud-native app.
66

77
## Learning objectives
88

learn-pr/aspnetcore/use-telemetry-dotnet-aspire/includes/2-telemetry-apis-dotnet.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
How can you investigate the behavior of an app for troubleshooting or performance optimization? The more data you have about what the app did, the easier it is to diagnose problems.
1+
How can you investigate an app's behavior for troubleshooting or performance optimization? The more data you have about what the app did, the easier it is to diagnose problems.
22

3-
Imagine you work for an outdoor equipment retailer. Your teams are building their microservices, ready for the testing phase. You want to ensure that your cloud-native app emits telemetry about its behavior so that you can diagnose problems during testing, staging, and production.
3+
Imagine you work for an outdoor equipment retailer. Your teams are building their microservices and are ready for the testing phase. You want to ensure that your cloud-native app emits telemetry about its behavior so that you can diagnose problems during testing, staging, and production.
44

55
In this unit, you'll learn about telemetry and the different kinds of data you can record with it.
66

77
## What is telemetry?
88

9-
In engineering, telemetry is the measurement of data and its automatic transmission to a central system for monitoring. For example, a racing car may record data about its performance and send it back to the paddock where engineers analyze it. Similarly a space capsule might record information about conditions in the capsule and send it back to mission control. In recent years, it's become common to record and analyze telemetry data in more common systems. For example, your central heating may send telemetry to the manufacturer to assist in troubleshooting.
9+
In engineering, telemetry is the measurement of data and its automatic transmission to a central system for monitoring. For example, a racing car might record data about its performance and send it back to the paddock where engineers analyze it. Similarly, a space capsule might record information about conditions in the capsule and send it back to mission control. In recent years, it's become common to record and analyze telemetry data in more common systems. For example, your central heating might send telemetry to the manufacturer to assist in troubleshooting.
1010

1111
If you're writing cloud-native apps, telemetry is helpful when:
1212

@@ -17,37 +17,37 @@ If you're writing cloud-native apps, telemetry is helpful when:
1717

1818
We can describe a system that emits rich telemetry as:
1919

20-
- **Observable**: An observable system is one that enables you to understand its behavior from outside it.
20+
- **Observable**: An observable system is one that allows you to understand its behavior from outside the system.
2121
- **Instrumented**: An instrumented system is one that emits all the data developers need to troubleshoot an issue.
2222

2323
**OpenTelemetry** is an observability framework and toolkit that you can use in your app to create, process, and emit telemetry data. You can easily add it to any .NET application, including microservices in a cloud-native app. It emits data in forms that common observability tools like Jaeger and Prometheus can use and analyze.
2424

2525
## Pillars of observability
2626

27-
The nature of cloud-native apps, which consist of distributed microservices that use disparate technologies, can make it difficult to build observable and properly instrumented code. All teams must integrate observability into their microservices, otherwise you may find that part of your app is difficult to monitor and troubleshoot.
27+
The nature of cloud-native apps, which consist of distributed microservices that use disparate technologies, can make it difficult to build observable and properly instrumented code. All teams must integrate observability into their microservices, otherwise you might find that part of your app is difficult to monitor and troubleshoot.
2828

2929
> [!IMPORTANT]
3030
> To ensure that your entire app is observable, you should ensure that all development teams consider the three pillars of observability in their microservices: **Logging**, **Metrics**, and **Tracing**.
3131
3232
The three pillars of observability are three different types of records that store the behavior of software integrations for later analysis:
3333

34-
- **Log**: a timestamped text record of what happened during the processing of a request.
35-
- **Metric**: a measurement of a service captured at runtime. Metric values can be aggregated into statistics about a process, including:
36-
- .NET Runtime statistics such as the memory used, or the number of garbage collections that occurred.
37-
- ASP.NET or NuGet package statistics such as the number of completed requests, request durations, or error counts.
34+
- **Log**: A timestamped text record of what happened during the processing of a request.
35+
- **Metric**: A measurement of a service captured at runtime. Metric values can be aggregated into statistics about a process, including:
36+
- .NET Runtime statistics, such as the memory used or the number of garbage collections that occurred.
37+
- ASP.NET or NuGet package statistics, such as the number of completed requests, request durations, or error counts.
3838
- Custom statistics that are specific to your app, such as the number of orders placed.
39-
- **Distributed Trace**: a record of all the units of work, often referred to as **Spans**, needed to handle an individual request. In a cloud-native app, many microservices and backing services may be involved in a single request and a distributed trace would show all of them as they collaborate to prepare the response.
39+
- **Distributed Trace**: A record of all the units of work, often referred to as *Spans*, needed to handle an individual request. In a cloud-native app, many microservices and backing services might be involved in a single request, and a distributed trace would show all of them as they collaborate to prepare the response.
4040

4141
> [!NOTE]
42-
> In OpenTelemetry, any data that is not part of a distributed trace or a metric is considered to be a log, for example, events.
42+
> In OpenTelemetry, any data that is not part of a distributed trace or a metric is considered to be a log; for example, events.
4343
4444
## Using telemetry in .NET
4545

4646
.NET has built-in types to represent the three pillars:
4747

4848
- **ILogger**: This interface provides a standard interface you can use when you what to log events from any .NET code.
4949
- **Meter**: You can use this class to create a group of instruments, each of which measures a value associated with the performance or behavior of your code. For example, you could add an instrument that counts the sales of a product, or another that measures the length of time a message waited in a queue. .NET also provides many built-in metrics.
50-
- **Activity**: You can use this class to record the tracing information. Start by creating an `ActivitySource` object for your namespace. Then call the `StartActivity` method to begin recording data.
50+
- **Activity**: You can use this class to record the tracing information. Start by creating an `ActivitySource` object for your namespace, then call the `StartActivity` method to begin recording data.
5151

5252
You can use these classes in any .NET code. In the next unit you'll see how .NET Aspire makes it easier to use OpenTelemetry classes in cloud-native apps.
5353

0 commit comments

Comments
 (0)