Skip to content

Commit

Permalink
Update Program.cs (#4411)
Browse files Browse the repository at this point in the history
Co-authored-by: Reiley Yang <[email protected]>
Co-authored-by: Cijo Thomas <[email protected]>
  • Loading branch information
3 people authored Apr 21, 2023
1 parent 10eb79c commit 678e9c4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/metrics/getting-started-aspnetcore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;

var appBuilder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);

// Configure OpenTelemetry with metrics and auto-start.
appBuilder.Services.AddOpenTelemetry()
.ConfigureResource(builder => builder
.AddService(serviceName: "OTel.NET Getting Started"))
.WithMetrics(builder => builder
builder.Services.AddOpenTelemetry()
.ConfigureResource(resource => resource
.AddService(serviceName: builder.Environment.ApplicationName))
.WithMetrics(metrics => metrics
.AddAspNetCoreInstrumentation()
.AddConsoleExporter((exporterOptions, metricReaderOptions) =>
{
metricReaderOptions.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds = 1000;
}));

var app = appBuilder.Build();
var app = builder.Build();

app.MapGet("/", () => $"Hello from OpenTelemetry Metrics!");

Expand Down

0 comments on commit 678e9c4

Please sign in to comment.