AngularJS版本1-Application Insights集成



我目前正在支持一个使用AngluarJS Version 1构建的应用程序。我对此很陌生。

我的任务是将Azure Application Insights集成到此应用程序中。下面的参考链接提供了有关使用npm进行集成的信息https://learn.microsoft.com/en-us/azure/azure-monitor/app/javascript

我不知道如何在AngularJS中编写下面的代码,这会导致错误。从"@microsoft/ApplicationInsights web"导入{ApplicationInsights}

请提供帮助,或者如果有任何参考,请分享。

我们可以使用NPM设置Snippet设置

对于NPM

npm i --save @microsoft/applicationinsights-web

配置Angular APP并包含依赖项

您可以使用environment.ts文件来存储InstrumentationKey

export const environment =  
{  
.  .  . 
appInsights:  { instrumentationKey:  '<Your Instrumentation Key>'  
}  
};

依赖项添加到包。json使用npm安装还原它

"dependencies":  {  "@microsoft/applicationinsights-web":  "~2.4.4",
...
}

有关的进一步步骤,请参阅此处

最新更新