Application Insights反复在trackException方法上记录异常

时间:2019-07-02 16:31:49

标签: azure-application-insights azure-application-insights-profiler

我有Angular 5 Web App,其中配置了1.0.20版的Application Insights js(applicationinsights-js)。 [https://www.npmjs.com/package/applicationinsights-js]

以下异常正在我们的生产应用程序见解中不断记录,因为有多少用户受到了影响。

Application Insights在其自身的程序集“ https://az416426.vo.msecnd.net/scripts/a/ai.0.js”中反复在trackException方法上记录异常

enter image description here

//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);

0 个答案:

没有答案