-
Notifications
You must be signed in to change notification settings - Fork 240
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
Single Page Application Page View Tracking #176
Comments
@gregjhogan regarding your comment on the related issue, where you said the roadblock for you was to find how to renew operation ID. Would this be easier for others we added documentation educating users on the possible (I hesitate to say "recommended", because it is not universal) approach of renewing operation ID when SPA page transition starts. |
Yes, for example should we use Util.newId, or the Operation constructor (both of which are not in the public documentation)? Also, I hope that creates a commitment to keeping the AI side of that integration stable. Thanks! |
Old issue, but I'd personally love to see some official docs on SPA + AI integration. |
I need to set this operation id differently. In some does, it's mentioned that to track the POST data, we need to send a trackTrace. But it doesn't talk about this operation id. After a lot of searching, I figured out that the operation id has to be the same here. The AJAX requests are automatically tracked, and when they fail, I issue a trackTrace the POST body. However, I don't have this operation id. This is quite complicated for tracking requests together here. |
So, in 2018/7/5, do we have a method to renew OperationID for SPA at each route change |
I agree that this needs better integrated tooling. This is a very common scenario and we shouldn't need a hack to make this work as most would expect. That all said, here's my hack for my tracing to put a new operationId on each client-side route navigation (here in an angular.js app in Typescript):
|
For React apps you can try react-appinsights: https://github.com/Azure/react-appinsights |
@pviotti I have tried the latest React Extension (https://github.com/microsoft/ApplicationInsights-JS/blob/master/extensions/applicationinsights-react-js). It doesn't seem to address this specific issue. While it is fairly easy to implement with the example application, all of the requests being tracked are considered the same operation as you can see below. I am not sure if I am just using this wrong or if I need to develop my own version of the extension that would utilize similar logic to what @andrejpk provided. If this is an issue witht he applicationinsights-react-js extension, I can log a specific issue. |
Adding for completeness that currently in v2.x the approach currently is almost the same as v1 if (appInsights && appInsights.context && appInsights.context.telemetryTrace) {
appInsights.context.telemetryTrace.traceID = generateW3CId(); // <- Sets the new Id using the generate W3c helper function
appInsights.context.telemetryTrace.name = toState.name;
} |
As part of #1705, I'm abstracting the distributed tracing support and providing another way of setting the traceId, spanId and traceFlags directly on the AI instance. Under the covers it will still be setting the The new approach will be |
Splitting out from the previous PR and linking to #1846 |
…or the core #1846 (#1847) * Task 7496325: Add Distributed tracing population for the properties for the core #1846 - Single Page Application Page View Tracking #176 - Run-time Telemetry initializers for Ajax requests #198 - How to modify traceflag in traceparent header? #1776 * Add initialization from previously set values. Also address CodeQL issues
Why different page views of the same session should be considered as different operation? |
This is generally used to separate page views in the portal for SPA, the values are set / updated here via the code listening to the location change events. What is your expectation for multiple page views with a SPA? |
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. |
Single page apps (such as AngularJS) need an easy way (using publicly documented APIs) to change the Operation ID each time the SPA changes the route.
The text was updated successfully, but these errors were encountered: