From 23aae0132506fdb00fe30c8b143c24bd4f5a706a Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 9 Oct 2024 18:18:29 +0200 Subject: [PATCH 1/3] refactor(instr-undici): avoid use of deprecated APIs for diagnostic channels (#2457) --- .../src/internal-types.ts | 4 +-- .../node/instrumentation-undici/src/undici.ts | 27 ++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/plugins/node/instrumentation-undici/src/internal-types.ts b/plugins/node/instrumentation-undici/src/internal-types.ts index 67c7fd6ce3..e6b2fff535 100644 --- a/plugins/node/instrumentation-undici/src/internal-types.ts +++ b/plugins/node/instrumentation-undici/src/internal-types.ts @@ -13,14 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import type { Channel } from 'diagnostics_channel'; import { UndiciRequest, UndiciResponse } from './types'; export interface ListenerRecord { name: string; - channel: Channel; - onMessage: (message: any, name: string | symbol) => void; + unsubscribe: () => void; } export interface RequestMessage { diff --git a/plugins/node/instrumentation-undici/src/undici.ts b/plugins/node/instrumentation-undici/src/undici.ts index 0d8ebedc73..1755b7417b 100644 --- a/plugins/node/instrumentation-undici/src/undici.ts +++ b/plugins/node/instrumentation-undici/src/undici.ts @@ -77,7 +77,7 @@ export class UndiciInstrumentation extends InstrumentationBase sub.channel.unsubscribe(sub.onMessage)); + this._channelSubs.forEach(sub => sub.unsubscribe()); this._channelSubs.length = 0; } @@ -137,14 +137,29 @@ export class UndiciInstrumentation extends InstrumentationBase void ) { - const channel = diagch.channel(diagnosticChannel); - channel.subscribe(onMessage); + // `diagnostics_channel` had a ref counting bug until v18.19.0. + // https://github.com/nodejs/node/pull/47520 + const [major, minor] = process.version + .replace('v', '') + .split('.') + .map(n => Number(n)); + const useNewSubscribe = major > 18 || (major === 18 && minor >= 19); + + let unsubscribe: () => void; + if (useNewSubscribe) { + diagch.subscribe?.(diagnosticChannel, onMessage); + unsubscribe = () => diagch.unsubscribe?.(diagnosticChannel, onMessage); + } else { + const channel = diagch.channel(diagnosticChannel); + channel.subscribe(onMessage); + unsubscribe = () => channel.unsubscribe(onMessage); + } + this._channelSubs.push({ name: diagnosticChannel, - channel, - onMessage, + unsubscribe, }); } From 3c7c0daa4c025462ed6eeef602568b6d0b8895a2 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Thu, 10 Oct 2024 10:09:10 +0200 Subject: [PATCH 2/3] ci: use codecov token when uploading reports (#2468) --- .github/workflows/unit-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index a60b6e246d..390ceabfb5 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -139,6 +139,8 @@ jobs: - name: Report Coverage if: ${{ matrix.code-coverage && !cancelled()}} uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: verbose: true @@ -170,5 +172,7 @@ jobs: run: npm run test:browser - name: Report Coverage uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: verbose: true From 645ac2e9fa322503e88283985f3f3bb2349a9729 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Thu, 10 Oct 2024 10:10:47 +0200 Subject: [PATCH 3/3] chore: remove @haddasbronfman and @osherv from component owners (#2466) --- .github/component-label-map.yml | 4 ++++ .github/component_owners.yml | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/component-label-map.yml b/.github/component-label-map.yml index 5ab8934eee..ae5125613e 100644 --- a/.github/component-label-map.yml +++ b/.github/component-label-map.yml @@ -278,6 +278,7 @@ pkg-status:unmaintained: - changed-files: - any-glob-to-any-file: - detectors/node/opentelemetry-resource-detector-github/** + - packages/opentelemetry-redis-common/** - plugins/node/instrumentation-fs/** - plugins/node/instrumentation-tedious/** - plugins/node/opentelemetry-instrumentation-connect/** @@ -288,6 +289,9 @@ pkg-status:unmaintained: - plugins/node/opentelemetry-instrumentation-knex/** - plugins/node/opentelemetry-instrumentation-koa/** - plugins/node/opentelemetry-instrumentation-memcached/** + - plugins/node/opentelemetry-instrumentation-mongodb/** + - plugins/node/opentelemetry-instrumentation-mysql/** + - plugins/node/opentelemetry-instrumentation-mysql2/** - plugins/node/opentelemetry-instrumentation-nestjs-core/** - plugins/node/opentelemetry-instrumentation-restify/** - plugins/node/opentelemetry-instrumentation-router/** diff --git a/.github/component_owners.yml b/.github/component_owners.yml index a6b5109ff9..9102833c14 100644 --- a/.github/component_owners.yml +++ b/.github/component_owners.yml @@ -42,8 +42,8 @@ components: - pichlermarc - legendecas - blumamir - packages/opentelemetry-redis-common: - - haddasbronfman + packages/opentelemetry-redis-common: [] + # Unmaintained packages/opentelemetry-test-utils: - dyladan - pichlermarc @@ -102,12 +102,12 @@ components: # Unmaintained plugins/node/opentelemetry-instrumentation-memcached: [] # Unmaintained - plugins/node/opentelemetry-instrumentation-mongodb: - - osherv - plugins/node/opentelemetry-instrumentation-mysql: - - haddasbronfman - plugins/node/opentelemetry-instrumentation-mysql2: - - haddasbronfman + plugins/node/opentelemetry-instrumentation-mongodb: [] + # Unmaintained + plugins/node/opentelemetry-instrumentation-mysql: [] + # Unmaintained + plugins/node/opentelemetry-instrumentation-mysql2: [] + # Unmaintained plugins/node/opentelemetry-instrumentation-nestjs-core: [] # Unmaintained plugins/node/opentelemetry-instrumentation-net: