Skip to content

Commit 05c1e0a

Browse files
authored
Fix the OpenTelemetry metrics tutorial (#37162)
1 parent 756f347 commit 05c1e0a

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

docs/core/diagnostics/metrics-collection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ This tutorial shows one of the integrations available for OpenTelemetry metrics
132132
Add a reference to the OpenTelemetry Prometheus exporter to the example app:
133133

134134
```dotnetcli
135-
dotnet add package OpenTelemetry.Exporter.Prometheus.AspNetCore --prerelease
135+
dotnet add package OpenTelemetry.Exporter.Prometheus.HttpListener --prerelease
136136
```
137137

138138
> [!NOTE]
@@ -145,7 +145,7 @@ Update `Program.cs` with OpenTelemetry configuration:
145145
In the preceding code:
146146

147147
- `AddMeter("HatCo.HatStore")` configures OpenTelemetry to transmit all the metrics collected by the Meter defined in the app.
148-
- `AddPrometheusExporter` configures OpenTelemetry to:
148+
- `AddPrometheusHttpListener` configures OpenTelemetry to:
149149
- Expose Prometheus' metrics endpoint on port `9184`
150150
- Use the HttpListener.
151151

docs/core/diagnostics/snippets/Metrics/Program.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ static void Main(string[] args)
4040
{
4141
using MeterProvider meterProvider = Sdk.CreateMeterProviderBuilder()
4242
.AddMeter("HatCo.HatStore")
43-
.AddPrometheusExporter(opt =>
44-
{
45-
opt.StartHttpListener = true;
46-
opt.HttpListenerPrefixes = new string[] { $"http://localhost:9184/" };
47-
})
43+
.AddPrometheusHttpListener(options => options.UriPrefixes = new string[] { "http://localhost:9464/" })
4844
.Build();
4945

5046
var rand = Random.Shared;

docs/core/diagnostics/snippets/Metrics/metric-instr.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="OpenTelemetry.Exporter.Prometheus" Version="1.3.0-rc.2" />
11+
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.HttpListener" Version="1.6.0-rc.1" />
1212
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="7.0.2" />
1313
</ItemGroup>
1414

0 commit comments

Comments
 (0)