-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@newrelic/native-metrics not working since v12.0.0 #2445
Comments
This is the issue. We do not provide pre-built binaries for musl based systems. As it stands today, the only way to get a musl based Node.js is to use an experimental unofficial build (https://github.com/nodejs/unofficial-builds). Note that the Docker images Node.js provides are shipping this unofficial build (unless something goes wrong): https://github.com/nodejs/docker-node/blob/766b2dec6f59b6c98bf190e818edb1b0c7e532c5/20/alpine3.20/Dockerfile#L21-L24 |
Ok so why did it work before v12.0.0 of |
@jeremiewtd Which version of |
@mrickard we upgraded from v11.23.2 |
v11.23.2 would have had the same condition. v11.x of the agent would install v10 of the native metrics package, and v12 of the agent installs v11 of the native metrics package. Between those releases of native metrics, the primary changes are the removal of support for Node 16, and a change to the CI runner used. The prebuilt binaries generated during release are
That's the valid list of binaries for v10.x and v11.x of the native metrics module. (v10.2.0 introduced support for Node 22, and v11.0.0 dropped support for Node 16.) Are you able to install the native metrics module from NPM? |
Yes I can but in the Dockerfile I need to install the following tools for the module to install correctly (for building I guess) otherwise I get an error "cannot find Python".
|
Ok, that would be missing from an alpine image. Would you be able to try a slim image? |
That doesn't work this the slim image either. Could this be a problem with changing your CI architecture? We build the image for amd64 and not arm64. |
After looking at our previous I made a repository to reproduce the issue. |
No, that is not the source of your issue. Release 10.1.0 (https://github.com/newrelic/node-native-metrics/releases/tag/v10.1.0) changed the way pre-builts are included. Prior to 10.1.0, they were published to a download site. On install of the module, the module would attempt to build itself locally. If that failed, it would attempt to find one via the download site: The
Notice that the So, in your setup with 10.0.1, the module was performing a custom build upon installation according to the script: https://github.com/newrelic/node-native-metrics/blob/v10.0.1/lib/pre-build.js With 10.1.0 we utilize the standard |
Ok thank you for explanation, so the solution for us should be :
Is that correct? Isn't this change breaking the functionality of newrelic? Because by updating the module we lost these “native metrics” |
Yes, using package.json{
"dependencies": {
"@newrelic/native-metrics": "^11.0.0"
}
} index.js'use strict'
const metrics = require('@newrelic/native-metrics')
console.log("gcEnabled:", metrics().gcEnabled) DockerfileFROM node:20-alpine AS builder
WORKDIR /app
COPY index.js package.json .
RUN apk add g++ make py3-pip
RUN npm install --production
FROM node:20-alpine
COPY --from=builder app/ /app/
WORKDIR /app
CMD node index.js $ docker build --tag demo .
$ docker run --rm -it demo
gcEnabled: true
I don't think so. We now ship a much more comprehensive matrix of pre-built binaries that do not require calls to an outside network to install. And we are now utilizing the standard build process in the absence of a pre-built for the target environment. So, in my view, we are more compatible, not less. Also, the Lines 154 to 169 in 32abe5f
|
We fixed the problem by installing the modules in our alpine container, thank you.
|
Glad to hear you have got it resolved. |
Since upgrading to v12.0.0 we have an error log running
newrelic
on our nodejs environment (node 20 or 22)Description
When loading
newrelic
we have the error below :It seems that the prebuilt version of this module is not installed in our Docker container, it worked perfectly before the version upgrade.
Expected Behavior
The module is well loaded and we can view metrics in the newrelic interface.
Steps to Reproduce
Use
newrelic
in a nodejs (express) application that is packaged in a Docker container usingFROM node:20-alpine
orFROM node:22-alpine
and runningnpm install
in theDockerfile
When starting the application (
docker run ...
) via the container an error is logged in thenewrelic_agent.log
(the error above).The text was updated successfully, but these errors were encountered: