apm-agent-nodejs icon indicating copy to clipboard operation
apm-agent-nodejs copied to clipboard

Only sends first batch of events to Elastic Agent on Deno

Open svenemtell opened this issue 9 months ago • 1 comments

I guess Deno is not a supported platform but... When running apm-agent-nodejs (4.13.0) in Deno (2.3.1) I only get the transactions sent the first 10 seconds. When running apm-agent-nodejs in Node.js it works as expected.

Here is some meta code.

Before starting Deno I set (among others): export ELASTIC_APM_LOG_LEVEL=trace

At the top of the file: import apm from "elastic-apm-node/start.js";

I make a number of transactions in a loop as a test.

loop
    const trans = apm.startTransaction
    trans.addLabels
    trans.end

Unfortunately I cannot get the full logs, but here is the essence of the trace messages in Node.js and Deno where you can see the differences.

Node.js

_write: encode object
gzipStream "finish"
start intakeResTimer
gzipStream "end"
completePart gzipStream
intakeReq "finish"
completePart intakeReq
intakeReq "response"
intakeRes "end"
completePart intakeRes
timeline...

intake request start
_write: encode object
intakeReq "socket": unref it

Deno

_write: encode object
gzipStream "finish"
start intakeResTimer
gzipStream "end"
completePart gzipStream
intakeReq "response"
intakeRes "end"
completePart intakeRes

As you can see the intakeReq "finish", completePart intakeReq, the timeline and the three last traces where the socket is unrefed are missing when running in Deno.

Any thoughts?

svenemtell avatar May 07 '25 20:05 svenemtell

Just wanted to let you know that this is not a problem for us anymore since we've started using the Deno OpenTelemetry support instead of the apm-agent-nodejs.

svenemtell avatar Jun 04 '25 19:06 svenemtell