Skip to content

Commit

Permalink
chore: remove support for node 8-12, add 18 (#1065)
Browse files Browse the repository at this point in the history
* chore: remove node 8 and 10 from CI

* chore: update engines

* chore: add node 18 to CI

* fix(resource-detector-alibaba-cloud): call .destroy() directly on the socket

* test: reference the actual error message

* test(instrumentation-fastify): check for similarity with ROOT_CONTEXT, not reference equality

In the CI there will be 3 instances of the API installed(relative to the repo root):

- `./plugins/node/opentelemetry-instrumentation-fastify/node_modules/@opentelemetry/api`,
- `./node_modules/@opentelemetry/api`,
- `./plugins/node/opentelemetry-instrumentation-fastify/node_modules/@opentelemetry/instrumentation-http/node_modules/@opentelemetry/api`.

* chore: remove support for node@12 updating the engines

* chore: remove test runs on node@12

* test(resource-detector-alibaba-cloud): revert change, disable tests for node@18

* fix: turn fastify tests off for node@18
  • Loading branch information
rauno56 committed Sep 15, 2022
1 parent 6c75487 commit 1277ce4
Show file tree
Hide file tree
Showing 55 changed files with 77 additions and 97 deletions.
21 changes: 1 addition & 20 deletions .github/workflows/test-all-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["8", "10", "12", "14", "16"]
include:
- node: "8"
lerna-extra-args: >-
--ignore @opentelemetry/instrumentation-aws-sdk
--ignore @opentelemetry/instrumentation-pino
--ignore @opentelemetry/instrumentation-tedious
--ignore @opentelemetry/instrumentation-amqplib
--ignore @opentelemetry/instrumentation-mongodb
--ignore @opentelemetry/instrumentation-redis-4
--ignore @opentelemetry/instrumentation-hapi
--ignore @opentelemetry/instrumentation-nestjs-core
- node: "10"
lerna-extra-args: >-
--ignore @opentelemetry/instrumentation-aws-sdk
--ignore @opentelemetry/instrumentation-pino
--ignore @opentelemetry/instrumentation-mongodb
--ignore @opentelemetry/instrumentation-redis-4
--ignore @opentelemetry/instrumentation-hapi
--ignore @opentelemetry/instrumentation-nestjs-core
node: ["14", "16", "18"]
runs-on: ubuntu-latest
services:
memcached:
Expand Down
25 changes: 6 additions & 19 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,13 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["8", "10", "12", "14", "16"]
node: ["14", "16", "18"]
include:
- node: "8"
# tests fail on node@18, incompatibility with nock?
- node: "18"
lerna-extra-args: >-
--ignore @opentelemetry/instrumentation-aws-sdk
--ignore @opentelemetry/instrumentation-pino
--ignore @opentelemetry/instrumentation-tedious
--ignore @opentelemetry/instrumentation-amqplib
--ignore @opentelemetry/instrumentation-redis-4
--ignore @opentelemetry/instrumentation-hapi
- node: "10"
lerna-extra-args: >-
--ignore @opentelemetry/instrumentation-aws-sdk
--ignore @opentelemetry/instrumentation-pino
--ignore @opentelemetry/instrumentation-redis-4
--ignore @opentelemetry/instrumentation-hapi
- node: "12"
lerna-extra-args: >-
--ignore @opentelemetry/instrumentation-redis-4
--ignore @opentelemetry/instrumentation-pino
--ignore @opentelemetry/resource-detector-alibaba-cloud
--ignore @opentelemetry/instrumentation-fastify
runs-on: ubuntu-latest
services:
memcached:
Expand Down Expand Up @@ -174,7 +161,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["12"]
node: ["14"]
runs-on: ubuntu-latest
env:
NPM_CONFIG_UNSAFE_PERM: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=10.0.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
2 changes: 1 addition & 1 deletion metapackages/auto-instrumentations-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node#readme",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion metapackages/auto-instrumentations-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-web#readme",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-host-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-id-generator-aws-xray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/esm/**/*.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-propagation-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"bugs": {
"url": "https://github.com/open-telemetry/opentelemetry-js-contrib/issues"
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"bugs": {
"url": "https://github.com/open-telemetry/opentelemetry-js-contrib/issues"
Expand Down
2 changes: 1 addition & 1 deletion plugins/node/instrumentation-amqplib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@
"typescript": "4.3.5"
},
"engines": {
"node": ">=10.0.0"
"node": ">=14"
}
}
2 changes: 1 addition & 1 deletion plugins/node/instrumentation-fs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
2 changes: 1 addition & 1 deletion plugins/node/instrumentation-lru-memoizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
2 changes: 1 addition & 1 deletion plugins/node/instrumentation-tedious/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=10.0.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
"typescript": "4.3.4"
},
"engines": {
"node": ">=12.0.0"
"node": ">=14"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"tracing"
],
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as assert from 'assert';
import { context, ROOT_CONTEXT, SpanStatusCode } from '@opentelemetry/api';
import { context, SpanStatusCode } from '@opentelemetry/api';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
Expand Down Expand Up @@ -72,6 +72,14 @@ import { FastifyInstance } from 'fastify/types/instance';

const Fastify = require('fastify');

const assertRootContextActive = () => {
// Asserting the context.active() to strictly equal ROOT_CONTEXT doesn't
// always work because of the linking and dep resolution.
// Specially in our CI environment there can be multiple instances to
// different @opentelemetry/api and thus ROOT_CONTEXTs in the tree.
assert.strictEqual((context.active() as any)['_currentContext'].size, 0);
};

function getSpans(): ReadableSpan[] {
const spans = memoryExporter.getFinishedSpans().filter(s => {
return (
Expand Down Expand Up @@ -367,9 +375,14 @@ describe('fastify', () => {
});

describe('application hooks', () => {
afterEach(() => {
const spans = getSpans();
assert.strictEqual(spans.length, 0);
});

it('onRoute not instrumented', async () => {
app.addHook('onRoute', () => {
assert.strictEqual(context.active(), ROOT_CONTEXT);
assertRootContextActive();
});
// add a route to trigger the 'onRoute' hook
app.get('/test', (_req: FastifyRequest, reply: FastifyReply) => {
Expand All @@ -381,7 +394,7 @@ describe('fastify', () => {

it('onRegister is not instrumented', async () => {
app.addHook('onRegister', () => {
assert.strictEqual(context.active(), ROOT_CONTEXT);
assertRootContextActive();
});
// register a plugin to trigger 'onRegister' hook
app.register((fastify, options, done) => {
Expand All @@ -393,19 +406,18 @@ describe('fastify', () => {

it('onReady is not instrumented', async () => {
app.addHook('onReady', () => {
assert.strictEqual(context.active(), ROOT_CONTEXT);
assertRootContextActive();
});

await startServer();
});

it('onClose is not instrumented', async () => {
app.addHook('onClose', () => {
assert.strictEqual(context.active(), ROOT_CONTEXT);
assertRootContextActive();
});

await startServer();
await app.close();
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.12.0"
"node": ">=14"
},
"files": [
"build/src/**/*.js",
Expand Down
Loading

0 comments on commit 1277ce4

Please sign in to comment.