angular - Application Insights 在 trackException 方法中重复记录异常
问题描述
我有 Angular 5 Web App,我在其中配置了 1.0.20 版(applicationinsights-js)的 Application Insights js。[ https://www.npmjs.com/package/applicationinsights-js]
由于大量用户受到影响,我们的 Production Application Insights 中持续记录了以下异常。
Application Insights 在其自己的程序集“ https://az416426.vo.msecnd.net/scripts/a/ai.0.js ”中重复记录trackException方法中的异常
//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);
解决方案
推荐阅读
- php - 嵌套来自两个数组的每个循环,其中第一个循环的行表示下一个循环
- r - r 基于同一向量中的两个值的子集/过滤器/选择组
- python - 合并熊猫数据框时得到错误的结果
- javascript - 如何使用 datalist 创建自动完成功能
- material-design - 使用 Angular5 更改 mat-slider 元素的值
- arrays - 地图功能中的额外 div 包装器
- jekyll - 如何使用 Liquid 模板系统访问非当前 for 循环元素
- javascript - 如果它在 svg 中,如何在 JS 中获取 img src?
- javascript - 数字三角形?
- php - 为什么我不能再创建 laravel 项目了?