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

Activity id of nettrace events are always 0 #102411

Closed
verdie-g opened this issue May 18, 2024 · 4 comments
Closed

Activity id of nettrace events are always 0 #102411

verdie-g opened this issue May 18, 2024 · 4 comments

Comments

@verdie-g
Copy link
Contributor

verdie-g commented May 18, 2024

Description

I noticed in all the nettrace collected from prod, all the ActivityId are RelatedActivityId are 0. One of the consequence is that the RequestStart/Stop events from ASP.NET Core can't be correlated.

Reproduction Steps

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => { });
app.Run();
  1. dotnet trace collect --process-id $PID --providers Microsoft-AspNetCore-Server-Kestrel --clreventlevel verbose
  2. Open the nettrace and observe that all ActivityId are equal to Guid.Empty

Expected behavior

I would expect to have non-0 ActivityId to correlate requests.

Actual behavior

All ActivityIds are 0.

Configuration

.NET: 8.0.105
OS: Windows
Arch: x64

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label May 18, 2024
Copy link
Contributor

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti
See info in area-owners.md if you want to be subscribed.

@tommcdon
Copy link
Member

@noahfalk

@noahfalk
Copy link
Member

This probably could be documented a little more clearly, but ActivityIDs are off by default so the behavior you see appears to be by design. If you want to turn them on you need to add provider System.Threading.Tasks.TplEventSource with keyword 0x80 (TasksFlowActivityIds). Check out the sample at https://learn.microsoft.com/en-us/dotnet/core/diagnostics/eventsource-activity-ids#tracking-work-using-an-activity-id.

@verdie-g
Copy link
Contributor Author

I didn't know about that thanks! I was able to get the activity ids using

dotnet trace collect --process-id $PID --providers Microsoft-AspNetCore-Server-Kestrel:0x0:informational,System.Threading.Tasks.TplEventSource:0x80:informational

@verdie-g verdie-g closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants