From 3e1fd4bd73e3faa14b28ce2d1d972b5a269ef0d2 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Sat, 5 Nov 2022 14:58:25 -0700 Subject: [PATCH] Added event counter instrumentation - Added counters for ASP.NET Core hosting --- .../Podcasts/Podcast.MinimalAPI/Podcast.MinimalAPI.csproj | 3 ++- src/Services/Podcasts/Podcast.MinimalAPI/Program.cs | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Services/Podcasts/Podcast.MinimalAPI/Podcast.MinimalAPI.csproj b/src/Services/Podcasts/Podcast.MinimalAPI/Podcast.MinimalAPI.csproj index 4b3b1df..2ea420c 100644 --- a/src/Services/Podcasts/Podcast.MinimalAPI/Podcast.MinimalAPI.csproj +++ b/src/Services/Podcasts/Podcast.MinimalAPI/Podcast.MinimalAPI.csproj @@ -26,7 +26,8 @@ - + + diff --git a/src/Services/Podcasts/Podcast.MinimalAPI/Program.cs b/src/Services/Podcasts/Podcast.MinimalAPI/Program.cs index 8977278..182fff0 100644 --- a/src/Services/Podcasts/Podcast.MinimalAPI/Program.cs +++ b/src/Services/Podcasts/Podcast.MinimalAPI/Program.cs @@ -97,7 +97,11 @@ builder.Services.AddOpenTelemetryMetrics(metrics => .AddHttpClientInstrumentation() .AddRuntimeInstrumentation() .AddProcessInstrumentation() - .AddHttpClientInstrumentation(); + .AddHttpClientInstrumentation() + .AddEventCountersInstrumentation(ec => + { + ec.AddEventSources("Microsoft.AspNetCore.Hosting"); + }); }); builder.Logging.AddOpenTelemetry(logging =>