dotnet / dotnet/aspnetcore

asp.net mvc returns wrong trace id in response body

Open
#44,679 6 comments 0 reactions 2 assignees Claimed by @halter73 View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

.net returns` Activity.Current?.Id` as trace id. I think it isn't correct. .net should return `Activity.Current?.TraceId`.
https://www.w3.org/TR/trace-context/#trace-id
Other 3rd parties such as logs, new relic use trace id(Activity.Current.TraceId), not Activity.Current.Id. https://github.com/dotnet/aspnetcore/blob/e543c705e9e691fc2cf8c0b014f186480c291844/src/Mvc/Mvc.Core/src/Infrastructure/DefaultProblemDetailsFactory.cs#L95

### Expected Behavior

Returns `Activity.Current?.TraceId` as traceId

### Steps To Reproduce

Throw some MVC validation error

### Exceptions (if any)

_No response_

### .NET Version

6

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.