Automatically inject correlation identifiers into log messages
See original GitHub issueI am trying to enable automatic correlation identifier injection using the package version 2.10.0. However, the logged properties (dd_trace_id, dd_version, dd_service, dd_env) are not being logged anymore.
I am using the SerilogExample as project to do the tests and I didn`t change anything, only the version of DataDog.Trace package. And the results are:
Datadog.Trace Version 1.31.2
-------------------------------
{"Timestamp":"2022-06-20T23:47:18.8214709-03:00","Level":"Information","MessageTemplate":"Message before a trace.","Properties":{"order-number":1024,"serviceName":"SerilogExample","applicationVersion":"1.0.0.0"}}
{"Timestamp":"2022-06-20T23:47:19.1242922-03:00","Level":"Information","MessageTemplate":"Message during a trace.","Properties":{"dd_service":"SerilogExample","dd_version":"1.0.0","dd_env":"dev","dd_trace_id":"8448889662018737848","dd_span_id":"6686629885022921939","order-number":1024,"serviceName":"SerilogExample","applicationVersion":"1.0.0.0"}}
{"Timestamp":"2022-06-20T23:47:19.1355577-03:00","Level":"Information","MessageTemplate":"Message after a trace.","Properties":{"order-number":1024,"serviceName":"SerilogExample","applicationVersion":"1.0.0.0"}}
Datadog.Trace Version 2.10.0
-------------------------------
{"Timestamp":"2022-06-20T23:48:18.8324620-03:00","Level":"Information","MessageTemplate":"Message before a trace.","Properties":{"order-number":1024,"serviceName":"SerilogExample","applicationVersion":"1.0.0.0"}}
{"Timestamp":"2022-06-20T23:48:19.1069486-03:00","Level":"Information","MessageTemplate":"Message during a trace.","Properties":{"order-number":1024,"serviceName":"SerilogExample","applicationVersion":"1.0.0.0"}}
{"Timestamp":"2022-06-20T23:48:19.1106834-03:00","Level":"Information","MessageTemplate":"Message after a trace.","Properties":{"order-number":1024,"serviceName":"SerilogExample","applicationVersion":"1.0.0.0"}}
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
Correlation Ids — Log4net Enrichment | by Jon Glass | Medium
Because the correlation id is injected manually into the messages, including correlation ids with all our page requests in the website would be...
Read more >How to correlate messages across services
Correlation ID can be set on log messages logged through log4net in multiple ways. You can include it directly on the LoggingEvent :...
Read more >A consistent approach to track correlation IDs through ...
The correlation ID can then be used to quickly find all the relevant log messages for this request (very easy to do in...
Read more >Adding Correlation IDs to Easily Track Down Errors
In this post, we'll look at how we can use Spring Cloud Sleuth to add trace IDs to our application to track down...
Read more >Correlation IDs - Code With Engineering Playbook
Log correlation is the ability to track disparate events through different parts of the application. Having a Correlation ID provides more ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
First, you seem to have properly handled context propagation in your code.
Then, regarding the tracer setup (the document linked is mainly linked to the agent), you could follow this inapp docs filtered on your setup where you setup the tracer in the container itself, setting the right environment variables:
Basically, it could look like something like this if you run on linux:
Then you would need to run docker by setting
-e DD_LOGS_INJECTION=true
as well.Here are some more examples if need be: https://www.datadoghq.com/blog/asp-dotnet-core-monitoring/ And our public documentation for complete details: https://docs.datadoghq.com/tracing/setup_overview/setup/dotnet-core?tab=windows
Thank you so much for your time @pierotibou