Dev*_*Dev 2 javascript azure azure-application-insights
我有一个用 JavaScript 编写的单页应用程序。我当前正在使用JavaScript API将事件记录到 Azure Application Insights 。此时,我正在使用如下代码记录事件:
let eventLog = {
name: 'Custom Event Name',
customDimensions: {
target: 'app'
},
customMeasurements: {
totalTime: '00:00:01.1234'
}
};
appInsights.trackEvent(eventLog);
Run Code Online (Sandbox Code Playgroud)
当我运行代码时,我注意到自定义事件正在写入我的 Application Insights 实例。虽然 Application Insights 中显示了正确的事件名称,但我没有看到任何自定义维度或自定义度量。
如何通过 JavaScript API 将自定义维度和自定义测量以及自定义事件记录到 Azure Application Insights?
谢谢你!
遥测对象的字段名称应分别为properties和measurements,代码如下。另外,测量项目的值应该是数字。
let eventLog = {
name: 'Custom Event Name',
properties: {
target: 'app'
},
measurements: {
totalTime: 0.34567
}
};
appInsights.trackEvent(eventLog);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5754 次 |
| 最近记录: |