Azure应用程序洞察-在来自JavaScript的自定义事件中使用自定义维度和自定义度量

Azure应用程序洞察-在来自JavaScript的自定义事件中使用自定义维度和自定义度量,javascript,azure,azure-application-insights,Javascript,Azure,Azure Application Insights,我有一个用JavaScript编写的单页应用程序。我目前正在使用将事件记录到Azure Application Insights。此时,我正在使用如下代码记录事件: let eventLog = { name: 'Custom Event Name', customDimensions: { target: 'app' }, customMeasurements: { totalTime: '00:00:01.1234' } }; appInsights.t

我有一个用JavaScript编写的单页应用程序。我目前正在使用将事件记录到Azure Application Insights。此时,我正在使用如下代码记录事件:

let eventLog = {
  name: 'Custom Event Name',
  customDimensions: {
    target: 'app'
  },
  customMeasurements: {
    totalTime: '00:00:01.1234'
  }
};

appInsights.trackEvent(eventLog);
当我运行代码时,我注意到自定义事件正在写入我的Application Insights实例。虽然Application Insights中显示了正确的事件名称,但我没有看到任何自定义维度或自定义度量

如何通过JavaScript API将自定义维度和带有自定义事件的自定义度量记录到Azure Application Insights


谢谢大家!

遥测对象的字段名应分别为
properties
measurements
,代码如下。此外,测量项目的值应为数字

let eventLog={
名称:'自定义事件名称',
特性:{
目标:“应用程序”
},
测量:{
总时间:0.34567
}
};
appInsights.trackEvent(事件日志);