From 142b2ec4e9030b8f3f715e41df0aa76e010a85fd Mon Sep 17 00:00:00 2001 From: mrickard Date: Mon, 20 May 2024 17:58:18 -0400 Subject: [PATCH 1/4] chore: Simplified Dockerfile and instrumentation Signed-off-by: mrickard --- src/nodejs/.dockerignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nodejs/.dockerignore b/src/nodejs/.dockerignore index 48912d2..3c3629e 100644 --- a/src/nodejs/.dockerignore +++ b/src/nodejs/.dockerignore @@ -1,2 +1 @@ -build -node_modules \ No newline at end of file +node_modules From 111ebec7592d4c1a3070972046b22fac43bf0d21 Mon Sep 17 00:00:00 2001 From: mrickard Date: Tue, 14 May 2024 13:23:42 -0400 Subject: [PATCH 2/4] chore: Changed Dockerfile to use build args for runtime and agent version Signed-off-by: mrickard Signed-off-by: mrickard --- src/nodejs/Dockerfile | 9 ++++++--- src/nodejs/src/newrelicinstrumentation.ts | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/nodejs/Dockerfile b/src/nodejs/Dockerfile index 7c440c7..8d3eedd 100644 --- a/src/nodejs/Dockerfile +++ b/src/nodejs/Dockerfile @@ -4,12 +4,15 @@ # update the `NODE_OPTIONS` environment variable accordingly. # In the first stage, install all the required packages in one custom directory. # Then in the second stage, copy the directory to `/instrumentation`. -# - Ensure you have `newrelic`, `@newrelic/aws-sdk`, `@newrelic/koa`, `@newrelic/superagent`, and `@newrelic/native-metrics` +# - Ensure you have `newrelic`, and`@newrelic/native-metrics`. # - Grant the necessary access to `/instrumentation` directory. `chmod -R go+r /instrumentation` -FROM node:20.12 AS build +ARG NODE_RUNTIME_VERSION=20 +ARG NEWRELIC_NODE_AGENT_VERSION=latest + +FROM node:${NODE_RUNTIME_VERSION} AS build WORKDIR /operator-build COPY . . -RUN npm install +RUN npm install newrelic@${NEWRELIC_NODE_AGENT_VERSION} FROM busybox COPY --from=build /operator-build/build/workspace /instrumentation diff --git a/src/nodejs/src/newrelicinstrumentation.ts b/src/nodejs/src/newrelicinstrumentation.ts index cac9f6d..2d96cb5 100644 --- a/src/nodejs/src/newrelicinstrumentation.ts +++ b/src/nodejs/src/newrelicinstrumentation.ts @@ -1,3 +1 @@ -const newrelic = require('newrelic'); - -export { newrelic }; +require('newrelic') From 6c2789a43243239f6e751a0702813cb350d18f82 Mon Sep 17 00:00:00 2001 From: mrickard Date: Mon, 20 May 2024 18:02:34 -0400 Subject: [PATCH 3/4] chore: Removed unneeded tsconfig and package.json Signed-off-by: mrickard --- src/nodejs/package.json | 19 ------------------- src/nodejs/tsconfig.json | 31 ------------------------------- 2 files changed, 50 deletions(-) delete mode 100644 src/nodejs/package.json delete mode 100644 src/nodejs/tsconfig.json diff --git a/src/nodejs/package.json b/src/nodejs/package.json deleted file mode 100644 index 07f6dd4..0000000 --- a/src/nodejs/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "newrelic", - "version": "0.0.1", - "private": true, - "scripts": { - "clean": "rimraf build/*", - "prepare": "npm run compile", - "compile": "tsc -p .", - "postcompile": "copyfiles -f 'build/src/**' build/workspace/ && copyfiles 'node_modules/**' build/workspace/" - }, - "devDependencies": { - "copyfiles": "^2.4.1", - "rimraf": "^5.0.5", - "typescript": "^5.4.3" - }, - "dependencies": { - "newrelic": "11.15.0" - } -} diff --git a/src/nodejs/tsconfig.json b/src/nodejs/tsconfig.json deleted file mode 100644 index 300f52b..0000000 --- a/src/nodejs/tsconfig.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "composite": true, - "declaration": true, - "declarationMap": true, - "forceConsistentCasingInFileNames": true, - "incremental": true, - "inlineSources": true, - "module": "commonjs", - "newLine": "LF", - "noEmitOnError": true, - "noFallthroughCasesInSwitch": true, - "noImplicitOverride": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "pretty": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "strictNullChecks": true, - "target": "es2017" - }, - "include": [ - "src/**/*.ts", - ] -} \ No newline at end of file From 72a2838d5b9cc796cb1dd2be122c24c91aa62ad9 Mon Sep 17 00:00:00 2001 From: mrickard Date: Mon, 20 May 2024 18:03:13 -0400 Subject: [PATCH 4/4] chore: Moved instrumentation file out of nodejs/src, renamed to .js Signed-off-by: mrickard --- .../newrelicinstrumentation.ts => newrelicinstrumentation.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/nodejs/{src/newrelicinstrumentation.ts => newrelicinstrumentation.js} (100%) diff --git a/src/nodejs/src/newrelicinstrumentation.ts b/src/nodejs/newrelicinstrumentation.js similarity index 100% rename from src/nodejs/src/newrelicinstrumentation.ts rename to src/nodejs/newrelicinstrumentation.js