diff --git a/examples/AspNetCore/Program.cs b/examples/AspNetCore/Program.cs index ac13f214365..e0bf8bac9db 100644 --- a/examples/AspNetCore/Program.cs +++ b/examples/AspNetCore/Program.cs @@ -115,7 +115,8 @@ builder.Services.AddOpenTelemetryMetrics(options => { options.SetResourceBuilder(resourceBuilder) - .AddHttpClientInstrumentation(); + .AddHttpClientInstrumentation() + .AddAspNetCoreInstrumentation(); var metricsExporter = builder.Configuration.GetValue("UseMetricsExporter").ToLowerInvariant(); switch (metricsExporter) @@ -132,8 +133,6 @@ default: options.AddConsoleExporter((exporterOptions, metricReaderOptions) => { - exporterOptions.Targets = ConsoleExporterOutputTargets.Console; - // The ConsoleMetricExporter defaults to a manual collect cycle. // This configuration causes metrics to be exported to stdout on a 10s interval. metricReaderOptions.MetricReaderType = MetricReaderType.Periodic;