Node.js Agent version 4.x

edit

See the Upgrade to v4.x guide.

4.10.0 - 2024/12/24

edit
Features
edit
  • Improve trace-level logging to better support debugging central config and transaction sampling issues. (#4291)

4.9.0 - 2024/12/09

edit
Features
edit
  • Add support for undici v7. (#4336)
Bug fixes
edit
  • Fix to support a internal refactor in mysql2 v3.11.5. (#4334)
  • Guard against a possible encoding error of tracing data in the APM client, before it is sent. It is possible this could wedge the APM client, resulting in the APM agent no longer sending tracing data. (#4359)

4.8.1 - 2024/11/04

edit
Bug fixes
edit
  • Fix AWS Lambda instrumentation to work with a "handler" string that includes a period (.) in the module path. E.g. the leading . in Handler: ./src/functions/myfunc/handler.main. (#4293).

4.8.0 - 2024/10/08

edit
Features
edit
  • Minor improvement to container ID parsing from /etc/cgroup v1 files in AWS ECS Fargate, where the pattern has been observed to sometimes differ from the documented pattern. (APM spec issue #888)
  • Add support for tedious v19. (#4218)
  • Add support for koa-router v13. (#4236)
Bug fixes
edit

4.7.3 - 2024/08/09

edit
Bug fixes
edit
  • Update import-in-the-middle to 1.11.0, which fixes an issue that can crash users using Nuxt and ESM. (#4175)

4.7.2 - 2024/08/01

edit
Features
edit
Bug fixes
edit
  • Fix for instrumentation for @aws-sdk/sns-client that will prevent a crash if the client is used when there is no parent transaction present. (#4168)
  • Fix for config resolution process. Before this change falsy config options coming from the elastic-apm-node.js file were ignored. (#4119)
  • Fix publishing of AWS Lambda layer to all AWS regions. This was broken in the 4.7.1 release. (#4171)

4.7.1 - 2024/07/24

edit
Bug fixes
edit
  • Update import-in-the-middle internally-used library to v1.9.1. This can fix usage with ESM code (see ECMAScript module support) in some cases, e.g. usage with Nuxt 3.

4.7.0 - 2024/06/13

edit
Features
edit
  • Update OpenTelemetry bridge support to @opentelemetry/api version 1.9.0. (#4078)

    Support for the new addLink and addLinks methods on Span have been added. However, support for the new synchronous gauge have not yet been added.

4.6.0 - 2024/06/05

edit
Features
edit
  • Make published docker.elastic.co/observability/apm-agent-nodejs Docker images multi-platform, with support for linux/amd64,linux/arm64 for now. This is necessary for users of the Elastic APM Attacher for Kubernetes, when deploying to k8s nodes that are ARM64 (e.g. Gravitron on AWS). (#4038)
Bug fixes
edit
  • Fix instrumentation for recent @aws-sdk/client-* releases that use @smithy/smithy-client v3. (For example @aws-sdk/[email protected] released 2024-05-13 updated to smithy-client v3.) Before this change the APM agent had been limiting patching of @smithy/smithy-client to >=1 <3. (#4036)
  • Mark the published AWS Lambda layers as supporting the "nodejs20.x" Lambda Runtime (--compatible-runtimes). The "nodejs20.x" runtime was released by AWS on 2023-11-15. (#4033)

    Note that this Node.js APM agent supports Node.js 20.x, so the new AWS Lambda runtime was supported when it was released. However, the metadata stating compatible runtimes (which is advisory) was not updated until now.

4.5.4 - 2024/05/13

edit
Bug fixes
edit
  • Change how the "cookie" HTTP request header is represented in APM transaction data to avoid a rare, but possible, intake bug where the transaction could be rejected due to a mapping conflict.

    Before this change a Cookie: foo=bar; sessionid=42 HTTP request header would be represented in the transaction document in Elasticsearch with these document fields (the example assumes sanitizeFieldNames matches "sessionid", as it does by default):

    http.request.headers.cookie: "[REDACTED]"
    ...
    http.request.cookies.foo: "bar"
    http.request.cookies.sessionid: "[REDACTED]"

    After this change it is represented as:

    http.request.headers.cookie: "foo=bar; sessionid=REDACTED"

    In other words, http.request.cookies are no longer separated out. (#4006)

4.5.3 - 2024/04/23

edit
Bug fixes
edit
  • Fix message handling for tombstone messages in kafkajs instrumentation. (#3985)

4.5.2 - 2024/04/12

edit
Bug fixes
edit
  • Fix path resolution for requests that contain invalid characters in its host header. (#3923)
  • Fix span names for getMore command of mongodb. (#3919)
  • Fix undici instrumentation to cope with a bug in [email protected] where request.addHeader() was accidentally removed. (It was re-added in [email protected].) (#3963)
  • Update undici instrumentation to avoid possibly adding a second traceparent header to outgoing HTTP requests, because this can break Elasticsearch requests. (#3964)

4.5.0 - 2024/03/13

edit
Features
edit
  • Update OpenTelemetry bridge support to @opentelemetry/api version 1.8.0.
  • Update tedious instrumentation to support versions 17 and 18. (#3901, #3911)
  • Add new kafkajs instrumentation. (#2905)
Bug fixes
edit
  • Fix instrumentation of mongodb to not break [email protected]. Mongodb v6.4.0 included changes that resulted in the APM agent’s instrumentation breaking it. (#3897)
  • Fix hostname detection on Windows in some cases (where a powershell profile could break collection). (#3899)
  • Fix a path normalization issue that broke (or partially broke) instrumentation of some modules on Windows: Next.js, redis v4+, mongodb. (#3905)

4.4.1 - 2024/02/06

edit
Bug fixes
edit
  • Add support for instrumentation of ES module-using (ESM) code with Node.js versions matching ^18.19.0 || >=20.2.0. Before this version of the APM agent, ESM instrumentation was only supported for some earlier Node.js versions. Changes in Node.js’s ESM loader in v18.19.0 and v20 broke earlier ESM support. (#3784, #3844)

4.4.0 - 2024/01/12

edit

Known issue: Using the APM agent’s ECMAScript module support with Node.js v18.19.0 is not supported in this version. Upgrade to APM agent version v4.5.0 or later, or use Node.js v18.18.1 or earlier. See https://github.com/elastic/apm-agent-nodejs/issues/3784 for details.

Features
edit
  • Support ELASTIC_APM_ACTIVATION_METHOD=K8S_ATTACH (in addition to the current K8S value) to indicate the agent is being started by apm-k8s-attacher. Newer releases of apm-k8s-attacher will be using this value (to have a common value used between APM agents).
Bug fixes
edit
  • Fix bug where NODE_ENV environment value was not used as a default for the environment config setting. The bug was introduced in v4.2.0. (#3807)
  • Improve Fastify instrumentation to no longer cause the FSTDEP017 and FSTDEP018 deprecation warnings. (#3814)

4.3.0 - 2023/12/05

edit

Known issue: Using the APM agent’s ECMAScript module support with Node.js v18.19.0 is not supported in this version. Upgrade to APM agent version v4.5.0 or later, or use Node.js v18.18.1 or earlier. See https://github.com/elastic/apm-agent-nodejs/issues/3784 for details.

Features
edit
  • Add the apmClientHeaders config option, to allow adding custom headers to HTTP requests made to APM server by the APM agent. (#3759)
Bug fixes
edit
  • Fix the dependency version range for @elastic/ecs-pino-format. (#3774)
Chores
edit
  • Skip undici tests for undici >=5.28.0 and NodeJS <14.18.0. (#3755)
  • Change the log level of Sending error to Elastic APM: ... from info to debug. There is no need to clutter the log output with this message. (#3748)
  • Explicitly mark this package as being of type="commonjs". The experimental node --experimental-default-type=module ... option added in Node.js v20.10.0 means that a default to "commonjs" isn’t guaranteed.

4.2.0 - 2023/11/23

edit
Breaking changes
edit
  • Drop support for next@11. Next.js instrumentation support is currently in technical preview, so it is not considered a semver-major change to drop support for this old version of next. (#3664)
Features
edit
Bug fixes
edit
  • Fix mongodb instrumentation to avoid loosing context when multiple cursors are running concurrently. (#3161)
  • Set mongodb span’s outcome according to the result of the command being traced. (#3695)
  • Fix @aws-sdk/client-sqs instrumentation which was failing for SendMessageBatch command when any of the entities does not contain MessageAttributes. (#3746)

4.1.0 - 2023/10/09

edit
Features
edit
  • Update OpenTelemetry bridge support to @opentelemetry/api version 1.6.0. #3622
  • Add support for @aws-sdk/client-dynamodb, one of the AWS SDK v3 clients. (#2958)
  • Add support for @aws-sdk/client-sns, one of the AWS SDK v3 clients. (#2956)
  • Add support for @aws-sdk/client-sqs, one of the AWS SDK v3 clients. (#2957)
  • Fixes for some values of the disableInstrumentations config setting. "redis" will now properly disable instrumentation for redis@4. "next" will propertly disable all Next.js instrumentation. (#3658)
Bug fixes
edit

4.0.0 - 2023/09/07

edit

See the Upgrade to v4.x guide.

Breaking changes
edit
  • Set the new minimum supported Node.js to version 14.17.0. Users of earlier Node.js versions can use elastic-apm-node v3.x, which supports back to Node.js v8.6.
  • Ignore a timer option passed to startTransaction() and startSpan() APIs. This option was never documented. It would be surprising if any user is impacted by this.
  • Remove long deprecated support for the ELASTIC_APM_-prefixed environment variables for the Kubernetes config options. For example, one must use KUBERNETES_POD_NAME and not ELASTIC_APM_KUBERNETES_POD_NAME. (#2661)
  • The config option filterHttpHeaders is now removed. (#3539)
  • Remove the deprecated span.toString() and transaction.toString() APIs. See the upgrading doc for details. (#2348)
  • Remove instrumentation support for the old hapi package — the current @hapi/hapi package is still instrumented. (#2691)
  • Change apm.startTransaction() api to return a noop transaction instead of null, if the agent is not yet started. (#2429)
  • Drop support for the obsolete "patch" context manager, i.e. the contextManager: "patch" config option. This was a limited async context management that predated the preferred AsyncLocalStorage core Node.js mechanism for context tracking. It was deprecated in v3.37.0. As well, the related and deprecated asyncHooks config option has been removed. (#3529)
  • Remove the logUncaughtExceptions config option. See Upgrading to v4 for details. (#2412)
  • Remove transaction.subtype and transaction.action properties from API. This also impacts apm.startTransaction([name][, type][, options]) and transaction.setType(...), both of which now no longer accept subtype and action parameters. These two properties were deprecated in v3.25.0. (#3557)
  • Remove support for the erroneous ELASTIC_SANITIZE_FIELD_NAMES and ELASTIC_IGNORE_MESSAGE_QUEUES config environment variables. The correct env vars are ELASTIC_APM_SANITIZE_FIELD_NAMES and ELASTIC_APM_IGNORE_MESSAGE_QUEUES, respectively, and were supported starting in v3.36.0.
Features
edit
  • The apm.destroy() method is now async. Almost no users should need to use this method. However, if used, to be sure to wait for APM agent shutdown to be complete, one can now await apm.destroy(). (#3222)
  • Support instrumenting mongodb v6. (#3596)
Bug fixes
edit
  • Fix instrumentation of mongodb to avoid multiple command handler registrations when client is created via MongoClient.connect static method. (#3586)
Chores
edit
  • Add a warning message when a duration or size config option is provided without units. (#2121)
  • Change default value of useElasticTraceparentHeader config option to false. This means that for outgoing HTTP requests, the APM agent will no longer add the elastic-apm-traceparent header. This vendor-specific header was used in the past while the W3C trace-context spec was still in development. Now that it is in wide use, the elastic-apm-traceparent header is only useful for interaction with very old Elastic APM agents.
  • Add default ports into context.service.target.name for HTTP spans conforming to the spec update done in https://github.com/elastic/apm/pull/700 (#3590)