question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connecting logs with traces

See original GitHub issue

First of all, I’d like to apologise for asking a question in an issue tracker.

I have what I think is a very simple use case, but I can’t find a way to do it. I have a fetch() call that, if it fails, should log the trace id, so that when searching for the trace id in Datadog, I am able to see both the request to https://my-domain.com and the error log:

fetch('https://my-domain.com')
  .catch(error => {
    logger.error('Request failed. Your error id is ${trace_id here}');
  });

How can I get the current trace id and inject it into the log? Do you think I shouldn’t be using trace ids for this?

Thanks.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
amortemousquecommented, May 16, 2022

I see. For now, this is the only way to get the trace_id but having another API to handle your use case could be considered at some point.

0reactions
bcaudancommented, Dec 26, 2022

For the initial question, https://github.com/DataDog/browser-sdk/issues/1061#issuecomment-1363086661 would be the recommended approach.

@hipitihop your topic seems a bit different, please open a separate issue if you still need assistance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connect Logs and Traces - Datadog Docs
Before correlating traces with logs, ensure your logs are either sent as JSON, or parsed by the proper language level log processor. Your...
Read more >
Connecting log data to traces | Dynatrace Docs
Automatically connecting log data to traces works for all log data, no matter how the log data was ingested by Dynatrace. You can...
Read more >
Correlate logs and traces - Logz.io Docs
Correlating Logs and Traces ... To manage log index patterns, click Index patterns and go to your default index pattern settings. ... Search...
Read more >
Viewing Logs and Traces - SAP Help Portal
The Trace Logs Details window appears with log messages and trace information. Click Download to download a text file of the trace information...
Read more >
How to easily correlate logs and APM traces for better ... - Elastic
Click on "Show trace logs". Et voila: Now you can see the logs associated with the trace in Elastic APM. These messages are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found