Open sherman89 opened 1 year ago
Is there a built-in way to Guid.TryParse a string or do I need my own custom layout renderer?
There is not built-in way to reformat string-value into valid Guid.
If I do need this custom wrapper, is it implemented correctly? Is it OK to use ThreadAgnostic when wrapping ActivityTraceLayoutRenderer?
Looks correct, and yes adding [ThreadAgnostic]
is correct optimization.
Is TraceId the same as activityId which seems to be deprecated?
Yes System.Diagnostics.CorrelationManager.ActivityId
is "obsolete", and has been replaced by System.Diagnostics.Activity.Current
Btw. you are wellcome to create a pull-request for this git-repo, that adds new enum-property TraceGuid
, so you have the option out of the box without needing custom layout-renderer.
We have a situation where I need to log the unique trace id to the database, but the column type is
uniqueidentifier
and the value ofTraceId
is what seems to be GUID without hyphens (ASP.NET Core 6) and saving it like that doesn't work. Unfortunately the database cannot be changed.Is there a built-in way to
Guid.TryParse
a string or do I need my own custom layout renderer?I managed to solve my issue by creating this layout wrapper:
Registration:
Usage:
If I do need this custom wrapper, is it implemented correctly? Is it OK to use
ThreadAgnostic
when wrappingActivityTraceLayoutRenderer
?Last question: Is TraceId the same as
activityId
which seems to be deprecated?Apologies if I missed some obvious piece of documentation somewhere, I tried looking but couldn't find an answer.
Thank you for all of your hard work!