Elastic APM
我如下集成到我的 Vue.js 应用程序中。它成功记录到 Elastic APM。
但是,它没有在日志中正确显示当前页面名称。它似乎总是显示应用程序在 APM 中安装的第一页。
我希望始终看到当前页面链接到相应的 APM 事件。任何建议如何实现这一目标?
文档说要设置pageLoadTransactionName
. 但是,它似乎没有在路线更改时更新此内容:
https ://www.elastic.co/guide/en/apm/agent/rum-js/current/custom-transaction-name.html
应用程序.js
mounted() {
this.initializeApm();
},
methods: {
initializeApm() {
const currentPage =
this.$route.name || window.location.href.split('#/')[1];
// initialize elastic apm
const apm = initApm({
serviceName: this.config.apm.serviceName,
serverUrl: this.config.apm.serverUrl,
serviceVersion: this.config.version,
pageLoadTransactionName: currentPage,
distributedTracingOrigins: [
'https://xxx.de',
],
environment: this.config.stage
});
apm.setUserContext({
id: this.getUserIdFromSession,
username: this.getUserNameFromSession,
email: this.getUserEmail
});
}
}