Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"license": "MIT",
"engines": {
"node": ">=18.0.0"
"node": ">=18.19.0"
},
"contributors": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/autoprofile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"semver": "^7.7.3"
},
"engines": {
"node": ">=18.0.0"
"node": ">=18.19.0"
},
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-fargate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@
"@instana/serverless": "4.29.0"
},
"engines": {
"node": ">=18.0.0"
"node": ">=18.19.0"
}
}
2 changes: 1 addition & 1 deletion packages/aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"tracing"
],
"engines": {
"node": ">=18.0.0"
"node": ">=18.19.0"
},
"contributors": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/azure-container-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"url": "https://github.com/instana/nodejs/issues"
},
"engines": {
"node": ">=18.0.0"
"node": ">=18.19.0"
},
"license": "MIT",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "git+https://github.com/instana/nodejs.git"
},
"engines": {
"node": ">=18.0.0"
"node": ">=18.19.0"
},
"scripts": {
"audit": "npm audit --omit=dev",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ let isActive = false;
exports.shouldAddHeadersToOptionsUnconditionally = function () {
return (
semver.eq(process.version, '21.0.0') ||
(semver.gte(process.version, '20.8.1') && semver.lt(process.version, '20.10.0')) ||
(semver.gte(process.version, '18.18.2') && semver.lt(process.version, '18.19.0'))
(semver.gte(process.version, '20.8.1') && semver.lt(process.version, '20.10.0'))
);
};

Expand Down
19 changes: 15 additions & 4 deletions packages/core/src/util/nodeJsVersionCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* This is the minimum required Node.js version for all @instana packages.
*/
exports.minimumNodeJsVersion = 18;
exports.minimumNodeJsVersion = '18.19.0';

/**
* Checks if the value of process.version denotes a Node.js version that is not supported, that is, older than the given
Expand All @@ -18,10 +18,21 @@ exports.minimumNodeJsVersion = 18;
exports.isNodeJsTooOld = function isNodeJsTooOld() {
const currentVersion = process.version;
if (typeof currentVersion === 'string') {
const majorVersionStr = process.version.split('.')[0];
const parts = currentVersion.split('.');
const majorVersionStr = parts[0];
if (majorVersionStr.length > 1 && majorVersionStr.charAt(0) === 'v') {
const majorVersion = parseInt(majorVersionStr.substring(1), 10);
return !isNaN(majorVersion) && majorVersion < exports.minimumNodeJsVersion;
const major = parseInt(majorVersionStr.slice(1), 10);
const minor = parseInt(parts[1], 10);
const patch = parseInt(parts[2], 10);

if (isNaN(major) || isNaN(minor) || isNaN(patch)) return false;

const [minMajor, minMinor, minPatch] = exports.minimumNodeJsVersion.split('.').map(Number);
return (
major < minMajor ||
(major === minMajor && minor < minMinor) ||
(major === minMajor && minor === minMinor && patch < minPatch)
);
}
}
return false;
Expand Down
4 changes: 3 additions & 1 deletion packages/core/test/tracing/supportedVersion_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ const supportedTracingVersion = require('../../src/tracing/supportedVersion');

describe('supported versions for Node.js auto tracing', () => {
it('must support various Node.js versions', () => {
expect(supportedTracingVersion('18.1.1')).to.equal(true);
expect(supportedTracingVersion('18.19.0')).to.equal(true);
expect(supportedTracingVersion('20.0.0')).to.equal(true);
expect(supportedTracingVersion('21.2.0')).to.equal(true);
expect(supportedTracingVersion('22.0.0')).to.equal(true);
expect(supportedTracingVersion('23.0.0')).to.equal(true);
expect(supportedTracingVersion('24.0.0')).to.equal(true);
expect(supportedTracingVersion('25.0.0')).to.equal(true);
});

it('must report various Node.js versions as not supported', () => {
Expand Down Expand Up @@ -45,5 +46,6 @@ describe('supported versions for Node.js auto tracing', () => {
expect(supportedTracingVersion('12.0.0')).to.equal(false);
expect(supportedTracingVersion('14.0.0')).to.equal(false);
expect(supportedTracingVersion('16.1.0')).to.equal(false);
expect(supportedTracingVersion('18.18.0')).to.equal(false);
});
});
15 changes: 15 additions & 0 deletions packages/core/test/util/nodeJsTooOld_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ describe('util.nodeJsTooOld', () => {
expect(isNodeJsTooOld()).to.be.true;
});

it('should reject Node.js 18.18.0', () => {
setProcessVersion('v18.18.0');
expect(isNodeJsTooOld()).to.be.true;
});

it('should reject Node.js 18.18.9', () => {
setProcessVersion('v18.18.0');
expect(isNodeJsTooOld()).to.be.true;
});

it('should accept Node.js 18.19.0', () => {
setProcessVersion('v18.19.0');
expect(isNodeJsTooOld()).to.be.false;
});

it('should accept if process.version is not set', () => {
setProcessVersion(undefined);
expect(isNodeJsTooOld()).to.be.false;
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-run/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@
"@instana/serverless": "4.29.0"
},
"engines": {
"node": ">=18.0.0"
"node": ">=18.19.0"
}
}
3 changes: 3 additions & 0 deletions packages/metrics-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@
"@instana/core": "4.29.0",
"@instana/shared-metrics": "4.29.0",
"node-fetch": "^2.6.7"
},
"engines": {
"node": ">=18.19.0"
}
}
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"CHANGELOG.md"
],
"engines": {
"node": ">=18.0.0"
"node": ">=18.19.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-sampler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"CHANGELOG.md"
],
"engines": {
"node": ">=18.0.0"
"node": ">=18.19.0"
},
"repository": {
"type": "git",
Expand Down
3 changes: 3 additions & 0 deletions packages/serverless-collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"esm-loader.mjs",
"esm-register.mjs"
],
"engines": {
"node": ">=18.19.0"
},
"publishConfig": {
"access": "public"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/serverless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"src",
"CHANGELOG.md"
],
"engines": {
"node": ">=18.19.0"
},
"publishConfig": {
"access": "public"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/shared-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"addons/linux",
"CHANGELOG.md"
],
"engines": {
"node": ">=18.19.0"
},
"publishConfig": {
"access": "public"
},
Expand Down