From 23dbc397842001e110ea668a4bb6082456294f24 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 17 Nov 2022 16:21:32 -0500 Subject: [PATCH] restore Activity.Current before all IIS LifeCycle events (#761) --- .../CHANGELOG.md | 3 +++ .../TelemetryHttpModule.cs | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/CHANGELOG.md index bd3006b278..5d81a5b705 100644 --- a/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +* Restore Activity.Current before all IIS Lifecycle events + ([#761](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/761)) + ## 1.0.0-rc9.6 Released 2022-Sep-28 diff --git a/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/TelemetryHttpModule.cs b/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/TelemetryHttpModule.cs index 4df4fb4366..62a45ef49d 100644 --- a/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/TelemetryHttpModule.cs +++ b/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/TelemetryHttpModule.cs @@ -84,12 +84,7 @@ private void Application_BeginRequest(object sender, EventArgs e) private void OnExecuteRequestStep(HttpContextBase context, Action step) { // Called only on 4.7.1+ runtimes - - if (context.CurrentNotification == RequestNotification.ExecuteRequestHandler && !context.IsPostNotification) - { - ActivityHelper.RestoreContextIfNeeded(context.ApplicationInstance.Context); - } - + ActivityHelper.RestoreContextIfNeeded(context.ApplicationInstance.Context); step(); }