File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
articles/azure-monitor/app Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -202,12 +202,11 @@ var builder = WebApplication.CreateBuilder(args);
202
202
203
203
// Add the OpenTelemetry telemetry service to the application.
204
204
// This service will collect and send telemetry data to Azure Monitor.
205
- builder .Services .AddOpenTelemetry ().UseAzureMonitor ();
206
-
207
- // Configure the OpenTelemetry tracer provider to add the resource attributes to all traces.
208
- builder .Services .ConfigureOpenTelemetryTracerProvider ((sp , builder ) =>
209
- builder .ConfigureResource (resourceBuilder =>
210
- resourceBuilder .AddAttributes (resourceAttributes )));
205
+ builder .Services .AddOpenTelemetry ()
206
+ .UseAzureMonitor ()
207
+ // Configure the ResourceBuilder to add the custom resource attributes to all signals.
208
+ // Custom resource attributes should be added AFTER AzureMonitor to override the default ResourceDetectors.
209
+ .ConfigureResource (resourceBuilder => resourceBuilder .AddAttributes (_testResourceAttributes ));
211
210
212
211
// Build the ASP.NET Core web application.
213
212
var app = builder .Build ();
You can’t perform that action at this time.
0 commit comments