From f7583b24314b92f0c874b7ffccde38819f7e0ac9 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 9 Feb 2024 13:20:21 +0100 Subject: [PATCH] Add options --- packages/server/src/utilities/scriptRunner.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/server/src/utilities/scriptRunner.ts b/packages/server/src/utilities/scriptRunner.ts index 417b847442..72042a5791 100644 --- a/packages/server/src/utilities/scriptRunner.ts +++ b/packages/server/src/utilities/scriptRunner.ts @@ -11,7 +11,7 @@ class ScriptRunner { private tracerSpan: Span constructor(script: string, context: any, { parseBson = false } = {}) { - this.tracerSpan = tracer.startSpan("scriptRunner") + this.tracerSpan = tracer.startSpan("scriptRunner", { tags: { parseBson } }) this.code = `(() => {${script}})();` this.vm = new IsolatedVM({ @@ -25,10 +25,14 @@ class ScriptRunner { } execute() { - const result = tracer.trace("scriptRunner.execute", () => { - const result = this.vm.execute(this.code) - return result - }) + const result = tracer.trace( + "scriptRunner.execute", + { childOf: this.tracerSpan }, + () => { + const result = this.vm.execute(this.code) + return result + } + ) this.tracerSpan.finish() return result }