Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AspNet HttpInListener OnStopActivity is called after Activity is stopped by TelemetryHttpModule #1138

Closed
jdaigle opened this issue May 18, 2022 · 0 comments · Fixed by #1388
Labels
bug Something isn't working comp:instrumentation.aspnet.telemetryhttpmodule Things related to OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule comp:instrumentation.aspnet Things related to OpenTelemetry.Instrumentation.AspNet

Comments

@jdaigle
Copy link

jdaigle commented May 18, 2022

Bug Report

List of all OpenTelemetry NuGet
packages
and version that you are
using (e.g. OpenTelemetry 1.0.2):

  • OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule 1.0.0-rc9.3
  • OpenTelemetry.Instrumentation.AspNet 1.0.0-rc9.3

Runtime version:

  • net48

Symptom

The "OpenTelemetry.Instrumentation.AspNet.Telemetry" span is processed and exported before it can be enriched by the the HttpInListener and any custom Enrich callbacks.

What is the expected behavior?

For example, the DisplayName of the Activity should be set to the MVC Route instead of the raw URL.

What is the actual behavior?

The DisplayName of the Activity remains the raw URL

Additional Context

In https://github.com/open-telemetry/opentelemetry-dotnet/blob/1.0.0-rc9.3/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/ActivityHelper.cs#L141, we can see that aspNetActivity.Stop(); is called before invoking the onRequestStoppedCallback. That callback is responsible for calling into OnStopActivity on HttpInListener which can update the name based on the route template can call the Enrich callback method.

I think that calling Stop() on the activity automatically triggers the ActivityListeners, including processors and exporters, to handle when the Activity is stopped.

Is it as simple as moving Stop() to after the callbacks?

@jdaigle jdaigle added the bug Something isn't working label May 18, 2022
@cijothomas cijothomas transferred this issue from open-telemetry/opentelemetry-dotnet Apr 11, 2023
@Kielek Kielek added comp:instrumentation.aspnet.telemetryhttpmodule Things related to OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule comp:instrumentation.aspnet Things related to OpenTelemetry.Instrumentation.AspNet labels Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working comp:instrumentation.aspnet.telemetryhttpmodule Things related to OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule comp:instrumentation.aspnet Things related to OpenTelemetry.Instrumentation.AspNet
Projects
None yet
2 participants