-
Notifications
You must be signed in to change notification settings - Fork 237
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
Reconfiguration of JS snippet via module import ignores settings #1370
Comments
Changing the configuration after initialization is not a (generally) supported scenario -- While it may (currently) work as a side effect of some plugin implementations, unless it's specifically documentation as "supported" ALL configuration should be set prior to calling initialize() on the appInsights instance. |
Thanks for the fast feedback. Is there any way to support the scenario I'm describing? We want to be able to catch client exceptions occurring prior to having application insights configuration settings available (these are tenant specific and we first need to fetch them from the API). I also tried replacing the ApplicationInsights instance created in the head section with a new one: but that resulted in having e.g. ajax dependencies being tracked twice. Can we somehow flush and dispose / unload the first instance before creating a new one? |
The Snippet should be handling catching all errors that occur from the point of running snippet script (i.e. any exceptions prior to snippet script won't be caught). You should be able to set you configuration on the snippet chunk (in the cfg section) and you can add the telemetry initializer to the queue mechanism that is available by (currently) adding some code to the end of the snippet script (in the same script tag) I have some ideas on making this a bit cleaner, but for now it's something like If you put the addTelemetryInitializer in a trailing script block, it very likely that the queue has already been processed and therefore the above code (the added queue function) will actually never get called. |
Linked to future enhancement #1427 and closing this issue |
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. |
Previously we just used the applicationinsights-web module in our Angular application, but that didn't track any exceptions occurring before loading the Angular ApplicationInsights service.
So now we load the ApplicationInsights CDN JS snippet in the head part of our page and after bootstrapping the Angular application we re-configure ApplicationInsights with values provided from our API.
In the head script we have
enableCorsCorrelation:false
it seems having the Angular service settingenableCorsCorrelation=true
on the global appInsights instance seems to have no effect.Correlation headers are missing.
Is there a proper way to provide new configuration values?
The text was updated successfully, but these errors were encountered: