Skip to content

Commit 496261b

Browse files
.
1 parent c73ae61 commit 496261b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/core/diagnostics/diagnostic-resource-monitoring.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ To use the metrics-based approach:
7575
1. Add the `Microsoft.Extensions.Diagnostics.ResourceMonitoring` package to your project.
7676
2. Add the resource monitoring services to your dependency injection container:
7777

78-
:::code source="snippets/resource-monitoring-with-manual-metrics/Program.cs" range="12":::
78+
```csharp
79+
services.AddResourceMonitoring();
80+
```
7981

8082
3. Configure metrics collection using any OpenTelemetry-compatible metrics collector. For example:
8183

@@ -96,7 +98,7 @@ For more detailed information about the available metrics and how to collect the
9698

9799
This chapter provides a 1:1 migration guide from the deprecated `IResourceMonitor` interface to the metrics-based approach. This is useful in case you need to manually listen to resource utilization metrics in your application. We provide this documentation for the sake of completeness, because, otherwise, you typically don't have to listen to metrics manually, as they are are automatically collected and exported to back-ends using the respective metrics exporters.
98100

99-
:::code source="snippets/resource-monitoring-with-manual-metrics/Program.cs" id="monitor" highlight="21-41":::
101+
:::code source="snippets/resource-monitoring-with-manual-metrics/Program.cs" id="monitor" highlight="20-41,54-57":::
100102

101103
The preceding code:
102104

File renamed without changes.

0 commit comments

Comments
 (0)