Azure Application Insights - 在来自 JavaScript 的自定义事件中使用自定义维度和自定义度量
Azure Application Insights - Using Custom Dimensions and Custom Measurements in Custom Events from JavaScript
我有一个用 JavaScript 编写的单页应用程序。我目前正在使用 JavaScript API 将事件记录到 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 = {
name: 'Custom Event Name',
properties: {
target: 'app'
},
measurements: {
totalTime: 0.34567
}
};
appInsights.trackEvent(eventLog);
我有一个用 JavaScript 编写的单页应用程序。我目前正在使用 JavaScript API 将事件记录到 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 = {
name: 'Custom Event Name',
properties: {
target: 'app'
},
measurements: {
totalTime: 0.34567
}
};
appInsights.trackEvent(eventLog);