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.

[Question] How to get `operation_Id` and `operation_ParentId` from an Angular front-end?

See original GitHub issue

Hi,

I want to get the operation_Id and operation_ParentId when a request fails so that I can search for the failed operation in Application Insights.

Ideally, I would like to get those IDs after a request is sent by Angular HttpClient. I know the traceparent in the request header contains those IDs, but there seems no way to get the request from Angular HttpClient. I am wondering if @microsoft/applicationinsights-web provides any functions to get those IDs.

Thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
IGx89commented, Apr 16, 2020

The bug I mentioned above is fixed now in the latest release, so I’m finding it very easy to use now. Here’s my code that adds the trace ID to a user-facing error message when an HTTP request fails (it runs inside an Axios response interceptor):

// Pull the W3C trace context ID from AI and add it to the error message.
if (window.appInsights) {
	const w3cTraceId = window.appInsights.context.telemetryTrace.traceID;
	if (w3cTraceId) {
		errorMessage += ' Error ID: ' + w3cTraceId;
	}
}

The ID, even just the first few characters of it, can then be entered into the Application Insights resource in the portal to find the operation details. Very slick!

0reactions
github-actions[bot]commented, Apr 21, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Get Application Insights Operation Id In Javascript
QUESTION : Do we get an Operation Id from the Web App? Or is this the Set the Telemetry Operation Parent Id to...
Read more >
Need help and guidance for accessing operationId in nodejs ...
I Need help in guiding me to the right documentation/ solution proposals. I read some articles(eg: How to get Application Insights operation id...
Read more >
Ensuring use of new Operation.id in pageView tracking - MSDN
In Angular 5 using 'applicationinsights-js' I am having trouble getting new operationIds to be generated for each page view.
Read more >
Getting started with Angular
You build Angular applications with components. Components define areas of responsibility in the UI that let you reuse sets of UI functionality. A...
Read more >
AdamPaternostro/Azure-App-Insights-Distrubuted-Tracing
A Web App (single page application – aka Angular) ... QUESTION: Do we get an Operation Id from the Web App? Or is...
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