I have Angular 5 Web App in which I have configured the Application Insights js of version 1.0.20 (applicationinsights-js). [https://www.npmjs.com/package/applicationinsights-js]
Following Exception was getting logged continuously in our Production Application Insights because of which lot of users are getting impacted.
Application Insights Logs Exception at trackException Method repeatedly in its own assembly "https://az416426.vo.msecnd.net/scripts/a/ai.0.js"
//This is my ApplicationInsightsService Angular service.
export class ApplicationInsightsService {
ikey: string;
constructor(private http: HttpClient) {
this.initializeApplicationInsights();
}
public initializeApplicationInsights() {
if (sessionStorage.getItem('ikey')) {
AppInsights.downloadAndSetup({ instrumentationKey: sessionStorage.getItem('ikey') });
}
}
//Track an exception in Appinsights
public logException(e: Error, handledAt?: string, properties?: any, measurements?: any) {
AppInsights.trackException(e, handledAt, properties, measurements);
}
}
`
//And In Angular, I have Global Error Handler,
//where we logged the Exceptions.
const applicationInsightsService = this.injector.get(ApplicationInsightsService);
applicationInsightsService.logException(error);