Remove magic strings from documentation
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
### Type of issue
Typo
### Description
In the code for section 5, Configure OpenTelemetry with the Correct Providers, the following code sample is given:
```C#
// Metrics provider from OpenTelemetry
.AddAspNetCoreInstrumentation()
.AddMeter(greeterMeter.Name)
// Metrics provides by ASP.NET Core in .NET 8
.AddMeter("Microsoft.AspNetCore.Hosting")
.AddMeter("Microsoft.AspNetCore.Server.Kestrel")
// Metrics provided by System.Net libraries
.AddMeter("System.Net.Http")
.AddMeter("System.Net.NameResolution")
.AddPrometheusExporter()
```
The calls to
```C#
.AddMeter("Microsoft.AspNetCore.Hosting")
.AddMeter("Microsoft.AspNetCore.Server.Kestrel")
```
are not necessary because they are already included with the call ```.AddAspNetCoreInstrumentation()```
Additionally, the calls to
```C#
.AddMeter("System.Net.Http")
.AddMeter("System.Net.NameResolution")
```
should be replaced with a call to ```.AddHttpClientInstrumentation()```
Using magic strings in documentation examples is confusing and should be discouraged - it makes me think that there are more undocumented ones that I'm missing out on, or that by calling the existing extensions, like ```.AddAspNetCoreInstrumentation()``` I'm not getting the hosting/kestrel meters, which is wrong.
### Page URL
https://learn.microsoft.com/en-us/dotnet/core/diagnostics/observability-prgrja-example
### Content source URL
https://github.com/dotnet/docs/blob/main/docs/core/diagnostics/observability-prgrja-example.md
### Document Version Independent Id
59d4807e-8b88-9d39-cd51-977792064cf6
### Article author
@tommcdon
### Metadata
* ID: eded9b69-1a38-a8bb-7e76-2f72a2e78abe
* PlatformId: 2f326b35-4a98-0694-da18-c1eb7c9dd0eb
* Service: **dotnet-fundamentals**
[Related Issues](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+59d4807e-8b88-9d39-cd51-977792064cf6)
Contributor guide
Assessment
This issue has not been assessed yet.