当通过开放竞速API或Elastic APM的API在Elsatic APM中嵌套时。有些跨度从未被记录下来。
使用import * as apm from '@elastic/apm-rum';
const transaction = this.apm.startTransaction('transaction-scene-loaded', 'custom'); // recorded
const span = this.apm.startSpan('span-scene-loaded', 'custom'); // recorded
const span2 = this.apm.startSpan('span-loading-state-updated', 'custom'); // Not recorded
span2.end();
span.end();
transaction.end();
使用Elastic的OpenTracing应用编程接口:
const {
init: initApm,
createTracer
} = require('@elastic/apm-rum/dist/bundles/elastic-apm-opentracing.umd.js');
跨度的行为同样不一致。事务何时开始或何时结束尚不清楚。某些跨度被转换为事务,并且嵌套跨度可能不会被记录。如果我声明一个页面范围的事务,Angular的ngOnInit
可以按跨度记录,但其他事件钩子永远不会被记录。
onLoaded() {
const span = this.tracer.startSpan('span-scene-loaded'); // Not recorded
// ...
span.end();
}
我已经尝试过它的变种。在span中包装span,childOf,应用级span,span的单个实例。
发布于 2019-08-01 05:04:17
要将跨度包括到事务中,您应该从transaction对象开始跨度
...
var span = transaction.startSpan('My custom span')
...
并且结束父事务对象时,所有嵌套的跨度也将以级联的形式结束
https://www.elastic.co/guide/en/apm/agent/js-base/4.x/transaction-api.html#transaction-start-span
https://stackoverflow.com/questions/57298727
复制相似问题