The Wayback Machine - https://web.archive.org/web/20220130083640/https://github.com/dotnet/aspnetcore/issues/39873
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

[Question] HttpContext.TraceIdentifier vs Activity.Current.Id #39873

Open
lonix1 opened this issue Jan 30, 2022 · 0 comments
Open

[Question] HttpContext.TraceIdentifier vs Activity.Current.Id #39873

lonix1 opened this issue Jan 30, 2022 · 0 comments

Comments

@lonix1
Copy link

@lonix1 lonix1 commented Jan 30, 2022

I asked this on SO first. There are no relevant docs.

I use a "trace id" in logs. Advice here and on SO is to get a traceid from HttpContext.TraceIdentifier.

But when the framework creates a ProblemDetails for a validation failure, it uses Activity.Current?.Id.

Examples:

var traceId1 = Activity.Current?.Id;        // OWZ4G27FO6UWH:00000003
var traceId2 = HttpContext.TraceIdentifier; // 00-2a8ee37903e657e3a95b41178dafc56e-91b02006afcf3133-00

I'm worried that my logs use one type, and the framework uses another - and when I need to analyse logs I'll have a problem.

Which does the framework typically use? And which should I use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant