From 9cf880abce6b49160ff5186168d3839b51ed567d Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 29 May 2025 11:50:22 +0200 Subject: [PATCH 01/74] chore: add new PR workflow --- .github/workflows/pr-test.yml | 253 ++++++++++++++++++++++++++++++++++ package.json | 5 +- 2 files changed, 257 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-test.yml diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml new file mode 100644 index 0000000000..c77b8b5cc6 --- /dev/null +++ b/.github/workflows/pr-test.yml @@ -0,0 +1,253 @@ +name: Pull Request Tests +on: + pull_request: + # TODO: remove it + branches: [main] + +jobs: + build-and-cache: + strategy: + fail-fast: false + runs-on: ubuntu-latest + env: + NPM_CONFIG_UNSAFE_PERM: true + NODE_OPTIONS: --max-old-space-size=4096 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + # Use the same Node.js version used for `release-please` workflow. + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install + run: npm ci + # TODO: check if compiling only the affected modules is correct + - name: Compile (Delta) + run: npm run compile:ci:changed + - name: Upload Build Artifacts + uses: actions/upload-artifact@v4 + with: + name: tests-build-cache-${{ github.run_number }} + path: .nx + include-hidden-files: true + if-no-files-found: error + retention-days: 1 + + unit-and-tav-test: + needs: build-and-cache + strategy: + fail-fast: false + matrix: + node: + - "18.19.0" + - "18" + - "20.6.0" + - "20" + - "22" + runs-on: ubuntu-latest + services: + memcached: + image: memcached:1.6.37-alpine + ports: + - 11211:11211 + mongo: + image: mongo + ports: + - 27017:27017 + mssql: + image: mcr.microsoft.com/mssql/server:2022-latest + env: + MSSQL_SA_PASSWORD: mssql_passw0rd + ACCEPT_EULA: Y + ports: + - 1433:1433 + options: >- + --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P $MSSQL_SA_PASSWORD -C -Q 'select 1' -b -o /dev/null" + --health-interval 1s + --health-timeout 30s + --health-start-period 10s + --health-retries 20 + mysql: + image: mysql:5.7 + env: + MYSQL_USER: otel + MYSQL_PASSWORD: secret + MYSQL_DATABASE: otel_mysql_database + MYSQL_ROOT_PASSWORD: rootpw + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + oracledb: + image: gvenzl/oracle-free:slim + env: + APP_USER: otel + APP_USER_PASSWORD: secret + ORACLE_PASSWORD: oracle + ports: + - 1521:1521 + options: >- + --health-cmd "sqlplus system/oracle@//localhost/FREEPDB1" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + postgres: + image: postgres:16-alpine + env: + POSTGRES_USER: postgres + POSTGRES_DB: otel_pg_database + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + redis: + image: redis + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + cassandra: + image: bitnami/cassandra:3 + ports: + - 9042:9042 + rabbitmq: + image: rabbitmq:3 + ports: + - 22221:5672 + env: + RABBITMQ_DEFAULT_USER: username + RABBITMQ_DEFAULT_PASS: password + env: + RUN_CASSANDRA_TESTS: 1 + RUN_MEMCACHED_TESTS: 1 + RUN_MONGODB_TESTS: 1 + RUN_MYSQL_TESTS: 1 + RUN_MSSQL_TESTS: 1 + RUN_ORACLEDB_TESTS: 1 + RUN_POSTGRES_TESTS: 1 + RUN_REDIS_TESTS: 1 + RUN_RABBIT_TESTS: 1 + CASSANDRA_HOST: localhost + MONGODB_DB: opentelemetry-tests + MONGODB_HOST: 127.0.0.1 + MONGODB_PORT: 27017 + MSSQL_PASSWORD: mssql_passw0rd + MYSQL_DATABASE: otel_mysql_database + MYSQL_HOST: 127.0.0.1 + MYSQL_PASSWORD: secret + MYSQL_ROOT_PASSWORD: rootpw + MYSQL_PORT: 3306 + MYSQL_USER: otel + OPENTELEMETRY_MEMCACHED_HOST: localhost + OPENTELEMETRY_MEMCACHED_PORT: 11211 + OPENTELEMETRY_REDIS_HOST: localhost + OPENTELEMETRY_REDIS_PORT: 6379 + ORACLE_HOSTNAME: localhost + ORACLE_PORT: 1521 + ORACLE_CONNECTSTRING: localhost:1521/freepdb1 + ORACLE_USER: otel + ORACLE_PASSWORD: secret + ORACLE_SERVICENAME: FREEPDB1 + POSTGRES_DB: otel_pg_database + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + NPM_CONFIG_UNSAFE_PERM: true + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - name: Set MySQL variables + run: mysql --user=root --password=${MYSQL_ROOT_PASSWORD} --host=${MYSQL_HOST} --port=${MYSQL_PORT} -e "SET GLOBAL log_output='TABLE'; SET GLOBAL general_log = 1;" mysql + - name: Install + run: npm ci + - name: Download Build Artifacts + uses: actions/download-artifact@v4 + with: + name: tests-build-cache-${{ github.run_number }} + path: .nx + # TODO: check if compiling only the affected modules is correct + - name: Compile (Delta) + run: npm run compile:ci:changed + - name: Unit tests (Delta) + run: npm run test:ci:changed + - name: Unit tests (Delta) + run: npm run test-all-versions:ci:changed + # TODO: save coverage for later + # - name: Upload Test Artifacts + # uses: actions/upload-artifact@v4 + # with: + # name: tests-coverage-cache-${{ github.run_number }}-${{ matrix.node }} + # path: .nx + # include-hidden-files: true + # if-no-files-found: error + # retention-days: 1 + # TODO: how to put back everythign in coverage??? + # test-coverage-report: + # runs-on: ubuntu-latest + # steps: + # - name: Download Test Artifacts + # uses: actions/download-artifact@v4 + # with: + # name: tests-build-cache-${{ github.run_number }} + # path: .nx + + # - name: Report Coverage + # uses: codecov/codecov-action@v5 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # verbose: true + + # browser-test: + # needs: build-and-cache + # strategy: + # fail-fast: false + # matrix: + # node: ["22"] + # runs-on: ubuntu-latest + # env: + # NPM_CONFIG_UNSAFE_PERM: true + # NODE_OPTIONS: --max-old-space-size=4096 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # - uses: actions/setup-node@v4 + # with: + # node-version: ${{ matrix.node }} + # - name: Install + # run: npm ci + # - name: Download Build Artifacts + # uses: actions/download-artifact@v4 + # with: + # name: tests-build-cache-${{ github.run_number }} + # path: .nx + # - name: Build + # run: npm run compile + # - name: Unit tests + # run: npm run test:browser + # - name: Report Coverage + # uses: codecov/codecov-action@v5 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # verbose: true diff --git a/package.json b/package.json index 42f95b8113..adf05710a9 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,13 @@ "clean": "nx run-many -t clean", "version:update": "nx run-many -t version:update", "compile": "nx run-many -t compile", + "compile:ci:changed": "nx affected -t compile --base=origin/main --head=HEAD", "test": "nx run-many -t test", - "test:browser": "nx run-many -t test:browser", "test:ci:changed": "nx affected -t test --base=origin/main --head=HEAD", + "test:browser": "nx run-many -t test:browser", + "test:browser:ci:changed": "nx affected -t test:browser --base=origin/main --head=HEAD", "test-all-versions": "nx run-many -t test-all-versions", + "test-all-versions:ci:changed": "nx affected -t test-all-versions --base=origin/main --head=HEAD", "changelog": "lerna-changelog", "lint": "nx run-many -t lint && npm run lint:deps && npm run lint:readme && npm run lint:markdown && npm run lint:semconv-deps", "lint:fix": "nx run-many -t lint:fix && npm run lint:markdown:fix", From 58702ed3ac34f603262992f679d2c1c53a2f7594 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 29 May 2025 12:12:39 +0200 Subject: [PATCH 02/74] chore: test ci:changed scripts --- plugins/node/instrumentation-undici/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/node/instrumentation-undici/package.json b/plugins/node/instrumentation-undici/package.json index 4b6af25c32..f801709261 100644 --- a/plugins/node/instrumentation-undici/package.json +++ b/plugins/node/instrumentation-undici/package.json @@ -16,7 +16,8 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "watch": "tsc -w", - "version:update": "node ../../../scripts/version-update.js" + "version:update": "node ../../../scripts/version-update.js", + "echo": "echo hi" }, "keywords": [ "opentelemetry", From 5b4e1b4b5914ddb23155b3bed825cdd1ab259390 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 29 May 2025 13:04:03 +0200 Subject: [PATCH 03/74] chore: upload test artifacts --- .github/workflows/pr-test.yml | 18 ++++++++++-------- .../node/instrumentation-undici/package.json | 5 ++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index c77b8b5cc6..54ba32f224 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -191,14 +191,16 @@ jobs: - name: Unit tests (Delta) run: npm run test-all-versions:ci:changed # TODO: save coverage for later - # - name: Upload Test Artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: tests-coverage-cache-${{ github.run_number }}-${{ matrix.node }} - # path: .nx - # include-hidden-files: true - # if-no-files-found: error - # retention-days: 1 + - name: Upload Test Artifacts + uses: actions/upload-artifact@v4 + with: + name: tests-coverage-cache-${{ github.run_number }}-${{ matrix.node }} + include-hidden-files: true + if-no-files-found: error + retention-days: 1 + path: | + **/.nyc_output/** + **/coverage/** # TODO: how to put back everythign in coverage??? # test-coverage-report: # runs-on: ubuntu-latest diff --git a/plugins/node/instrumentation-undici/package.json b/plugins/node/instrumentation-undici/package.json index f801709261..aae9230ce2 100644 --- a/plugins/node/instrumentation-undici/package.json +++ b/plugins/node/instrumentation-undici/package.json @@ -9,15 +9,14 @@ "prepublishOnly": "npm run compile", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-undici", "compile": "tsc -p .", - "test": "nyc mocha test/**/*.test.ts", + "test": "nyc --no-clean mocha test/**/*.test.ts", "test-all-versions": "tav", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "watch": "tsc -w", - "version:update": "node ../../../scripts/version-update.js", - "echo": "echo hi" + "version:update": "node ../../../scripts/version-update.js" }, "keywords": [ "opentelemetry", From 294b6e4a42bd4ac9d853c5482c2c213b2f0f0da4 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 29 May 2025 19:16:30 +0200 Subject: [PATCH 04/74] chore: add logs in coverage step --- .github/workflows/pr-test.yml | 44 ++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 54ba32f224..4458289d05 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -188,7 +188,7 @@ jobs: run: npm run compile:ci:changed - name: Unit tests (Delta) run: npm run test:ci:changed - - name: Unit tests (Delta) + - name: Test All Versions (Delta) run: npm run test-all-versions:ci:changed # TODO: save coverage for later - name: Upload Test Artifacts @@ -199,24 +199,36 @@ jobs: if-no-files-found: error retention-days: 1 path: | + !node_modules **/.nyc_output/** **/coverage/** # TODO: how to put back everythign in coverage??? - # test-coverage-report: - # runs-on: ubuntu-latest - # steps: - # - name: Download Test Artifacts - # uses: actions/download-artifact@v4 - # with: - # name: tests-build-cache-${{ github.run_number }} - # path: .nx - - # - name: Report Coverage - # uses: codecov/codecov-action@v5 - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # with: - # verbose: true + test-coverage-report: + runs-on: ubuntu-latest + steps: + - name: Download Test Artifacts (18) + uses: actions/download-artifact@v4 + with: + name: tests-coverage-cache-${{ github.run_number }}-18 + path: . + - name: Download Test Artifacts (20) + uses: actions/download-artifact@v4 + with: + name: tests-coverage-cache-${{ github.run_number }}-20 + path: . + - name: Download Test Artifacts (22) + uses: actions/download-artifact@v4 + with: + name: tests-coverage-cache-${{ github.run_number }}-22 + path: . + - name: List all directories + run: find . -type d + # - name: Report Coverage + # uses: codecov/codecov-action@v5 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # verbose: true # browser-test: # needs: build-and-cache From 780ffcd2e0cefee69b584ac8b713564be165732d Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 29 May 2025 19:19:30 +0200 Subject: [PATCH 05/74] chore: add job dependency --- .github/workflows/pr-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 4458289d05..cd9353ea44 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -205,6 +205,7 @@ jobs: # TODO: how to put back everythign in coverage??? test-coverage-report: runs-on: ubuntu-latest + needs: build-and-cache steps: - name: Download Test Artifacts (18) uses: actions/download-artifact@v4 From de2e6ef04be6e2d1b71ca044630bf5e7842219f3 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 29 May 2025 19:25:09 +0200 Subject: [PATCH 06/74] chore: fix dependencies in jobs --- .github/workflows/pr-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index cd9353ea44..17f58cadca 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -205,7 +205,7 @@ jobs: # TODO: how to put back everythign in coverage??? test-coverage-report: runs-on: ubuntu-latest - needs: build-and-cache + needs: unit-and-tav-test steps: - name: Download Test Artifacts (18) uses: actions/download-artifact@v4 From ad59caf34fd72cf4a148cc7339ff312b8b6816ef Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 29 May 2025 19:39:37 +0200 Subject: [PATCH 07/74] chore: add missing steps to coverage job --- .github/workflows/pr-test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 17f58cadca..1d01e0da4f 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -207,6 +207,15 @@ jobs: runs-on: ubuntu-latest needs: unit-and-tav-test steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install + run: npm ci - name: Download Test Artifacts (18) uses: actions/download-artifact@v4 with: From c019193f88a49461eb77102f39608dca5d68c840 Mon Sep 17 00:00:00 2001 From: David Luna Date: Fri, 30 May 2025 12:39:22 +0200 Subject: [PATCH 08/74] chore: remove other PR workflows --- .github/workflows/test-all-versions.pr.yml | 34 --- .github/workflows/unit-test.yml | 238 --------------------- 2 files changed, 272 deletions(-) delete mode 100644 .github/workflows/test-all-versions.pr.yml delete mode 100644 .github/workflows/unit-test.yml diff --git a/.github/workflows/test-all-versions.pr.yml b/.github/workflows/test-all-versions.pr.yml deleted file mode 100644 index 9f1309ad19..0000000000 --- a/.github/workflows/test-all-versions.pr.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: TAV for PR -on: - pull_request: - types: - - opened - - synchronize - - reopened - - labeled - - unlabeled - -jobs: - parse-labels: - runs-on: ubuntu-latest - container: - image: node:20 - env: - PR_LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }} - outputs: - args: ${{ steps.npm-workspace-args.outputs.args }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Parse labels into npm workspace arguments - id: npm-workspace-args - run: | - OUTPUT=`node scripts/pr-labels-to-npm-workspace-args.mjs "$PR_LABELS"` - echo "args=$OUTPUT" >> $GITHUB_OUTPUT - - tav: - uses: ./.github/workflows/test-all-versions.yml - needs: parse-labels - with: - npm-workspace-args: ${{ needs.parse-labels.outputs.args }} - if: ${{ needs.parse-labels.outputs.args != '' }} diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml deleted file mode 100644 index 68826df198..0000000000 --- a/.github/workflows/unit-test.yml +++ /dev/null @@ -1,238 +0,0 @@ -name: Unit Tests -on: - push: - branches: [main] - pull_request: - -jobs: - build-and-cache: - strategy: - fail-fast: false - runs-on: ubuntu-latest - env: - NPM_CONFIG_UNSAFE_PERM: true - NODE_OPTIONS: --max-old-space-size=4096 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - # Use the same Node.js version used for `release-please` workflow. - - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: Install - run: npm ci - - name: Build - run: npm run compile - - name: Upload Build Artifacts - uses: actions/upload-artifact@v4 - with: - name: tests-build-cache-${{ github.run_number }} - path: .nx - include-hidden-files: true - if-no-files-found: error - retention-days: 1 - - unit-test: - needs: build-and-cache - strategy: - fail-fast: false - matrix: - node: - - "18.19.0" - - "18" - - "20.6.0" - - "20" - - "22" - include: - - node: 18 - code-coverage: true - runs-on: ubuntu-latest - services: - memcached: - image: memcached:1.6.37-alpine - ports: - - 11211:11211 - mongo: - image: mongo - ports: - - 27017:27017 - mssql: - image: mcr.microsoft.com/mssql/server:2022-latest - env: - MSSQL_SA_PASSWORD: mssql_passw0rd - ACCEPT_EULA: Y - ports: - - 1433:1433 - options: >- - --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P $MSSQL_SA_PASSWORD -C -Q 'select 1' -b -o /dev/null" - --health-interval 1s - --health-timeout 30s - --health-start-period 10s - --health-retries 20 - mysql: - image: mysql:5.7 - env: - MYSQL_USER: otel - MYSQL_PASSWORD: secret - MYSQL_DATABASE: otel_mysql_database - MYSQL_ROOT_PASSWORD: rootpw - ports: - - 3306:3306 - options: >- - --health-cmd="mysqladmin ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - oracledb: - image: gvenzl/oracle-free:slim - env: - APP_USER: otel - APP_USER_PASSWORD: secret - ORACLE_PASSWORD: oracle - ports: - - 1521:1521 - options: >- - --health-cmd "sqlplus system/oracle@//localhost/FREEPDB1" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - postgres: - image: postgres:16-alpine - env: - POSTGRES_USER: postgres - POSTGRES_DB: otel_pg_database - POSTGRES_PASSWORD: postgres - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - redis: - image: redis - ports: - - 6379:6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - cassandra: - image: bitnami/cassandra:3 - ports: - - 9042:9042 - rabbitmq: - image: rabbitmq:3 - ports: - - 22221:5672 - env: - RABBITMQ_DEFAULT_USER: username - RABBITMQ_DEFAULT_PASS: password - env: - RUN_CASSANDRA_TESTS: 1 - RUN_MEMCACHED_TESTS: 1 - RUN_MONGODB_TESTS: 1 - RUN_MYSQL_TESTS: 1 - RUN_MSSQL_TESTS: 1 - RUN_ORACLEDB_TESTS: 1 - RUN_POSTGRES_TESTS: 1 - RUN_REDIS_TESTS: 1 - RUN_RABBIT_TESTS: 1 - CASSANDRA_HOST: localhost - MONGODB_DB: opentelemetry-tests - MONGODB_HOST: 127.0.0.1 - MONGODB_PORT: 27017 - MSSQL_PASSWORD: mssql_passw0rd - MYSQL_DATABASE: otel_mysql_database - MYSQL_HOST: 127.0.0.1 - MYSQL_PASSWORD: secret - MYSQL_ROOT_PASSWORD: rootpw - MYSQL_PORT: 3306 - MYSQL_USER: otel - OPENTELEMETRY_MEMCACHED_HOST: localhost - OPENTELEMETRY_MEMCACHED_PORT: 11211 - OPENTELEMETRY_REDIS_HOST: localhost - OPENTELEMETRY_REDIS_PORT: 6379 - ORACLE_HOSTNAME: localhost - ORACLE_PORT: 1521 - ORACLE_CONNECTSTRING: localhost:1521/freepdb1 - ORACLE_USER: otel - ORACLE_PASSWORD: secret - ORACLE_SERVICENAME: FREEPDB1 - POSTGRES_DB: otel_pg_database - POSTGRES_HOST: localhost - POSTGRES_PORT: 5432 - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - NPM_CONFIG_UNSAFE_PERM: true - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - - name: Set MySQL variables - run: mysql --user=root --password=${MYSQL_ROOT_PASSWORD} --host=${MYSQL_HOST} --port=${MYSQL_PORT} -e "SET GLOBAL log_output='TABLE'; SET GLOBAL general_log = 1;" mysql - - name: Install - run: npm ci - - name: Download Build Artifacts - uses: actions/download-artifact@v4 - with: - name: tests-build-cache-${{ github.run_number }} - path: .nx - - name: Build - run: npm run compile - - name: Unit tests (Full) - if: matrix.code-coverage - run: npm run test - - name: Unit tests (Delta) - if: ${{ !matrix.code-coverage }} - run: npm run test:ci:changed - - name: Report Coverage - if: ${{ matrix.code-coverage && !cancelled()}} - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - verbose: true - - browser-test: - needs: build-and-cache - strategy: - fail-fast: false - matrix: - node: ["22"] - runs-on: ubuntu-latest - env: - NPM_CONFIG_UNSAFE_PERM: true - NODE_OPTIONS: --max-old-space-size=4096 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - - name: Install - run: npm ci - - name: Download Build Artifacts - uses: actions/download-artifact@v4 - with: - name: tests-build-cache-${{ github.run_number }} - path: .nx - - name: Build - run: npm run compile - - name: Unit tests - run: npm run test:browser - - name: Report Coverage - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - verbose: true From 4d13f2ef2c45aeffe7c561031e485bfe634d6152 Mon Sep 17 00:00:00 2001 From: David Luna Date: Mon, 2 Jun 2025 17:52:23 +0200 Subject: [PATCH 09/74] chore: add some logs in pr workflow --- .github/workflows/pr-test.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 1d01e0da4f..339c482579 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -190,6 +190,9 @@ jobs: run: npm run test:ci:changed - name: Test All Versions (Delta) run: npm run test-all-versions:ci:changed + # TODO: remove + - name: List instr files + run: find plugins/node/instrumentation-undici # TODO: save coverage for later - name: Upload Test Artifacts uses: actions/upload-artifact@v4 @@ -201,7 +204,7 @@ jobs: path: | !node_modules **/.nyc_output/** - **/coverage/** + # TODO: how to put back everythign in coverage??? test-coverage-report: runs-on: ubuntu-latest @@ -231,8 +234,8 @@ jobs: with: name: tests-coverage-cache-${{ github.run_number }}-22 path: . - - name: List all directories - run: find . -type d + - name: List instr files + run: find plugins/node/instrumentation-undici # - name: Report Coverage # uses: codecov/codecov-action@v5 # env: From 368d918515a95b5bd8525469fe118d33722f81b3 Mon Sep 17 00:00:00 2001 From: David Luna Date: Mon, 2 Jun 2025 22:25:35 +0200 Subject: [PATCH 10/74] chore: rename scripts --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index adf05710a9..8da704240d 100644 --- a/package.json +++ b/package.json @@ -15,13 +15,13 @@ "clean": "nx run-many -t clean", "version:update": "nx run-many -t version:update", "compile": "nx run-many -t compile", - "compile:ci:changed": "nx affected -t compile --base=origin/main --head=HEAD", + "compile:ci:affected": "nx affected -t compile --base=origin/main --head=HEAD", "test": "nx run-many -t test", - "test:ci:changed": "nx affected -t test --base=origin/main --head=HEAD", + "test:ci:affected": "nx affected -t test --base=origin/main --head=HEAD", "test:browser": "nx run-many -t test:browser", - "test:browser:ci:changed": "nx affected -t test:browser --base=origin/main --head=HEAD", + "test:browser:ci:affected": "nx affected -t test:browser --base=origin/main --head=HEAD", "test-all-versions": "nx run-many -t test-all-versions", - "test-all-versions:ci:changed": "nx affected -t test-all-versions --base=origin/main --head=HEAD", + "test-all-versions:ci:affected": "nx affected -t test-all-versions --base=origin/main --head=HEAD", "changelog": "lerna-changelog", "lint": "nx run-many -t lint && npm run lint:deps && npm run lint:readme && npm run lint:markdown && npm run lint:semconv-deps", "lint:fix": "nx run-many -t lint:fix && npm run lint:markdown:fix", From 652af62b61cac654a1047d10671e5fcdb95a36f2 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 10:32:52 +0200 Subject: [PATCH 11/74] chore: add coverage merge script --- .github/workflows/pr-test.yml | 18 +++++++++--------- .../node/instrumentation-undici/package.json | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 339c482579..ed99904a16 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -183,17 +183,12 @@ jobs: with: name: tests-build-cache-${{ github.run_number }} path: .nx - # TODO: check if compiling only the affected modules is correct - name: Compile (Delta) run: npm run compile:ci:changed - name: Unit tests (Delta) run: npm run test:ci:changed - name: Test All Versions (Delta) run: npm run test-all-versions:ci:changed - # TODO: remove - - name: List instr files - run: find plugins/node/instrumentation-undici - # TODO: save coverage for later - name: Upload Test Artifacts uses: actions/upload-artifact@v4 with: @@ -205,7 +200,6 @@ jobs: !node_modules **/.nyc_output/** - # TODO: how to put back everythign in coverage??? test-coverage-report: runs-on: ubuntu-latest needs: unit-and-tav-test @@ -219,6 +213,7 @@ jobs: node-version: 18 - name: Install run: npm ci + # TODO: add the rest of versions (18.19.0 & 20.6.0)? or are these enough?? - name: Download Test Artifacts (18) uses: actions/download-artifact@v4 with: @@ -234,9 +229,14 @@ jobs: with: name: tests-coverage-cache-${{ github.run_number }}-22 path: . - - name: List instr files - run: find plugins/node/instrumentation-undici - # - name: Report Coverage + - name: List instr folders + run: ls -la plugins/node/instrumentation-undici + - name: Merge coverage + run: cd plugins/node/instrumentation-undici && npm run coverage:merge + - name: Check coverage + run: find plugins/node/instrumentation-undici/coverage + + # - name: Report Coverage # uses: codecov/codecov-action@v5 # env: # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/plugins/node/instrumentation-undici/package.json b/plugins/node/instrumentation-undici/package.json index e39fa04c7d..a2677e903c 100644 --- a/plugins/node/instrumentation-undici/package.json +++ b/plugins/node/instrumentation-undici/package.json @@ -16,7 +16,8 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "watch": "tsc -w", - "version:update": "node ../../../scripts/version-update.js" + "version:update": "node ../../../scripts/version-update.js", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "opentelemetry", From 17ea030c2fec69267409dd9cc1a079bc9ffc89ca Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 10:35:22 +0200 Subject: [PATCH 12/74] fix: use the new affected scripts --- .github/workflows/pr-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index ed99904a16..4f0e1c7b31 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -25,7 +25,7 @@ jobs: run: npm ci # TODO: check if compiling only the affected modules is correct - name: Compile (Delta) - run: npm run compile:ci:changed + run: npm run compile:ci:affected - name: Upload Build Artifacts uses: actions/upload-artifact@v4 with: @@ -184,11 +184,11 @@ jobs: name: tests-build-cache-${{ github.run_number }} path: .nx - name: Compile (Delta) - run: npm run compile:ci:changed + run: npm run compile:ci:affected - name: Unit tests (Delta) - run: npm run test:ci:changed + run: npm run test:ci:affected - name: Test All Versions (Delta) - run: npm run test-all-versions:ci:changed + run: npm run test-all-versions:ci:affected - name: Upload Test Artifacts uses: actions/upload-artifact@v4 with: From 03e8c677d2e236ef6d37431fe064b17227747331 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 11:03:35 +0200 Subject: [PATCH 13/74] chore: update amqplib test script --- .github/workflows/pr-test.yml | 12 +++++------- package.json | 1 + plugins/node/instrumentation-amqplib/package.json | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 4f0e1c7b31..7956e4a490 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -229,14 +229,12 @@ jobs: with: name: tests-coverage-cache-${{ github.run_number }}-22 path: . - - name: List instr folders - run: ls -la plugins/node/instrumentation-undici - - name: Merge coverage - run: cd plugins/node/instrumentation-undici && npm run coverage:merge + - name: Merge coverage (Delta) + run: npm run coverage:merge:ci:affected - name: Check coverage - run: find plugins/node/instrumentation-undici/coverage - - # - name: Report Coverage + run: find . | grep coverage-final + + # - name: Report Coverage # uses: codecov/codecov-action@v5 # env: # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/package.json b/package.json index 8da704240d..7c14853474 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "test:browser:ci:affected": "nx affected -t test:browser --base=origin/main --head=HEAD", "test-all-versions": "nx run-many -t test-all-versions", "test-all-versions:ci:affected": "nx affected -t test-all-versions --base=origin/main --head=HEAD", + "coverage:merge:ci:affected": "nx affected -t coverage:merge --base=origin/main --head=HEAD", "changelog": "lerna-changelog", "lint": "nx run-many -t lint && npm run lint:deps && npm run lint:readme && npm run lint:markdown && npm run lint:semconv-deps", "lint:fix": "nx run-many -t lint:fix && npm run lint:markdown:fix", diff --git a/plugins/node/instrumentation-amqplib/package.json b/plugins/node/instrumentation-amqplib/package.json index 1fdae36d46..506f07226c 100644 --- a/plugins/node/instrumentation-amqplib/package.json +++ b/plugins/node/instrumentation-amqplib/package.json @@ -34,7 +34,7 @@ "lint:readme": "node ../../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "version:update": "node ../../../scripts/version-update.js", "watch": "tsc -w", From 0254c128d77fff5e1d61654b68767699fcbf12be Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 11:30:25 +0200 Subject: [PATCH 14/74] chore: update scripts --- plugins/node/instrumentation-amqplib/package.json | 3 ++- plugins/node/instrumentation-cucumber/package.json | 5 +++-- plugins/node/instrumentation-dataloader/package.json | 5 +++-- plugins/node/instrumentation-fs/package.json | 2 +- plugins/node/instrumentation-kafkajs/package.json | 5 +++-- plugins/node/instrumentation-lru-memoizer/package.json | 5 +++-- plugins/node/instrumentation-runtime-node/package.json | 5 +++-- plugins/node/instrumentation-socket.io/package.json | 5 +++-- 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/plugins/node/instrumentation-amqplib/package.json b/plugins/node/instrumentation-amqplib/package.json index 506f07226c..72ab0c44e6 100644 --- a/plugins/node/instrumentation-amqplib/package.json +++ b/plugins/node/instrumentation-amqplib/package.json @@ -38,7 +38,8 @@ "test-all-versions": "tav", "version:update": "node ../../../scripts/version-update.js", "watch": "tsc -w", - "test:docker:run": "docker run -d --hostname demo-amqplib-rabbit --name amqplib-unittests -p 22221:5672 --env RABBITMQ_DEFAULT_USER=username --env RABBITMQ_DEFAULT_PASS=password rabbitmq:3" + "test:docker:run": "docker run -d --hostname demo-amqplib-rabbit --name amqplib-unittests -p 22221:5672 --env RABBITMQ_DEFAULT_USER=username --env RABBITMQ_DEFAULT_PASS=password rabbitmq:3", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" diff --git a/plugins/node/instrumentation-cucumber/package.json b/plugins/node/instrumentation-cucumber/package.json index b6c87a599b..fe4803c600 100644 --- a/plugins/node/instrumentation-cucumber/package.json +++ b/plugins/node/instrumentation-cucumber/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", @@ -16,7 +16,8 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-cucumber", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "cucumber", diff --git a/plugins/node/instrumentation-dataloader/package.json b/plugins/node/instrumentation-dataloader/package.json index 1ad751e19a..753387d9b4 100644 --- a/plugins/node/instrumentation-dataloader/package.json +++ b/plugins/node/instrumentation-dataloader/package.json @@ -13,9 +13,10 @@ "lint:fix": "eslint . --ext .ts --fix", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", - "version:update": "node ../../../scripts/version-update.js" + "version:update": "node ../../../scripts/version-update.js", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "dataloader", diff --git a/plugins/node/instrumentation-fs/package.json b/plugins/node/instrumentation-fs/package.json index e377045007..3671a57a79 100644 --- a/plugins/node/instrumentation-fs/package.json +++ b/plugins/node/instrumentation-fs/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", diff --git a/plugins/node/instrumentation-kafkajs/package.json b/plugins/node/instrumentation-kafkajs/package.json index f958cb48c9..6ce953e9d1 100644 --- a/plugins/node/instrumentation-kafkajs/package.json +++ b/plugins/node/instrumentation-kafkajs/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha --require @opentelemetry/contrib-test-utils 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha --require @opentelemetry/contrib-test-utils 'test/**/*.test.ts'", "test-all-versions": "tav", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", @@ -16,7 +16,8 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-kafkajs", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "kafkajs", diff --git a/plugins/node/instrumentation-lru-memoizer/package.json b/plugins/node/instrumentation-lru-memoizer/package.json index 3cbafd4a1c..30703d44e4 100644 --- a/plugins/node/instrumentation-lru-memoizer/package.json +++ b/plugins/node/instrumentation-lru-memoizer/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", @@ -16,7 +16,8 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-lru-memoizer", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "lru-memoizer", diff --git a/plugins/node/instrumentation-runtime-node/package.json b/plugins/node/instrumentation-runtime-node/package.json index de6ad9c646..3123f9de8a 100644 --- a/plugins/node/instrumentation-runtime-node/package.json +++ b/plugins/node/instrumentation-runtime-node/package.json @@ -13,8 +13,9 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "prepublishOnly": "npm run compile", - "test": "nyc mocha 'test/**/*.test.ts'", - "version:update": "node ../../../scripts/version-update.js" + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "version:update": "node ../../../scripts/version-update.js", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "author": "OpenTelemetry Authors", "license": "Apache-2.0", diff --git a/plugins/node/instrumentation-socket.io/package.json b/plugins/node/instrumentation-socket.io/package.json index 1d916bd4cf..85d1d84f60 100644 --- a/plugins/node/instrumentation-socket.io/package.json +++ b/plugins/node/instrumentation-socket.io/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", @@ -16,7 +16,8 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-socket.io", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "socket.io", From 24794141af3822226fadadeb71c14b932a697c4e Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 12:11:53 +0200 Subject: [PATCH 15/74] chore: revert cucumber instr changes --- plugins/node/instrumentation-cucumber/package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/node/instrumentation-cucumber/package.json b/plugins/node/instrumentation-cucumber/package.json index fe4803c600..b6c87a599b 100644 --- a/plugins/node/instrumentation-cucumber/package.json +++ b/plugins/node/instrumentation-cucumber/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "test": "nyc mocha 'test/**/*.test.ts'", "test-all-versions": "tav", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", @@ -16,8 +16,7 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-cucumber", - "compile": "tsc -p .", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "compile": "tsc -p ." }, "keywords": [ "cucumber", From cbedab699c0521636ecc7ffd543491b96cc03315 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 13:05:04 +0200 Subject: [PATCH 16/74] chore: add more plugins to coverage --- plugins/node/instrumentation-tedious/package.json | 5 +++-- plugins/node/instrumentation-typeorm/package.json | 5 +++-- .../opentelemetry-instrumentation-aws-lambda/package.json | 5 +++-- .../node/opentelemetry-instrumentation-aws-sdk/.tav.yml | 8 ++++---- .../opentelemetry-instrumentation-aws-sdk/package.json | 5 +++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/plugins/node/instrumentation-tedious/package.json b/plugins/node/instrumentation-tedious/package.json index ec2449d0a2..ccfd97a0fe 100644 --- a/plugins/node/instrumentation-tedious/package.json +++ b/plugins/node/instrumentation-tedious/package.json @@ -13,9 +13,10 @@ "lint": "eslint . --ext .ts", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", - "version:update": "node ../../../scripts/version-update.js" + "version:update": "node ../../../scripts/version-update.js", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index 1de69531e6..a20888ad5a 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -15,11 +15,12 @@ "prewatch": "npm run precompile", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "typeorm", diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json index cca8c64cca..be7b5ac9cc 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", @@ -15,7 +15,8 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-aws-lambda", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "aws-lambda", diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml index 0ec6e8b36b..3fea9b90b3 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml @@ -12,7 +12,7 @@ exclude: ">=3.363.0 <=3.377.0" mode: "max-7" commands: - - mocha --require '@opentelemetry/contrib-test-utils' test/bedrock-runtime.test.ts + - nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' test/bedrock-runtime.test.ts "@aws-sdk/client-s3": env: @@ -25,8 +25,8 @@ exclude: "3.529.0 || >=3.363.0 <=3.377.0" mode: "max-7" commands: - - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-s3.test.ts - - mocha --require '@opentelemetry/contrib-test-utils' test/s3.test.ts + - nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-s3.test.ts + - nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' test/s3.test.ts "@aws-sdk/client-sqs": env: @@ -38,4 +38,4 @@ exclude: ">=3.363.0 <=3.377.0" mode: "max-7" commands: - - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-sqs.test.ts + - nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-sqs.test.ts diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json index ba1a8b2d9a..c4a30acac7 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json @@ -35,10 +35,11 @@ "lint:readme": "node ../../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" From 22b32f2a22e92b7fabd443783f34f388bd55ab2d Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 13:26:56 +0200 Subject: [PATCH 17/74] chore: add another batch of instrumentations --- .../node/opentelemetry-instrumentation-bunyan/package.json | 5 +++-- .../opentelemetry-instrumentation-cassandra/package.json | 5 +++-- .../node/opentelemetry-instrumentation-connect/package.json | 5 +++-- plugins/node/opentelemetry-instrumentation-dns/package.json | 5 +++-- .../node/opentelemetry-instrumentation-express/package.json | 5 +++-- .../node/opentelemetry-instrumentation-fastify/package.json | 5 +++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-bunyan/package.json b/plugins/node/opentelemetry-instrumentation-bunyan/package.json index f823803cbd..c744d42a49 100644 --- a/plugins/node/opentelemetry-instrumentation-bunyan/package.json +++ b/plugins/node/opentelemetry-instrumentation-bunyan/package.json @@ -13,9 +13,10 @@ "lint:fix": "eslint . --ext .ts --fix", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", - "version:update": "node ../../../scripts/version-update.js" + "version:update": "node ../../../scripts/version-update.js", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "bunyan", diff --git a/plugins/node/opentelemetry-instrumentation-cassandra/package.json b/plugins/node/opentelemetry-instrumentation-cassandra/package.json index 1781d2f3d9..742d773117 100644 --- a/plugins/node/opentelemetry-instrumentation-cassandra/package.json +++ b/plugins/node/opentelemetry-instrumentation-cassandra/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", @@ -15,7 +15,8 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-cassandra-driver", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "cassandra-driver", diff --git a/plugins/node/opentelemetry-instrumentation-connect/package.json b/plugins/node/opentelemetry-instrumentation-connect/package.json index 9a58368051..0e97c228d4 100644 --- a/plugins/node/opentelemetry-instrumentation-connect/package.json +++ b/plugins/node/opentelemetry-instrumentation-connect/package.json @@ -13,9 +13,10 @@ "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "connect", diff --git a/plugins/node/opentelemetry-instrumentation-dns/package.json b/plugins/node/opentelemetry-instrumentation-dns/package.json index cc90e65e76..6c4b7a507e 100644 --- a/plugins/node/opentelemetry-instrumentation-dns/package.json +++ b/plugins/node/opentelemetry-instrumentation-dns/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", @@ -15,7 +15,8 @@ "version:update": "node ../../../scripts/version-update.js", "lint:readme": "node ../../../scripts/lint-readme", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-dns", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "dns", diff --git a/plugins/node/opentelemetry-instrumentation-express/package.json b/plugins/node/opentelemetry-instrumentation-express/package.json index 1735be4613..feef49cced 100644 --- a/plugins/node/opentelemetry-instrumentation-express/package.json +++ b/plugins/node/opentelemetry-instrumentation-express/package.json @@ -7,7 +7,7 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "test-all-versions": "tav", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", @@ -17,7 +17,8 @@ "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-express", "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "express", diff --git a/plugins/node/opentelemetry-instrumentation-fastify/package.json b/plugins/node/opentelemetry-instrumentation-fastify/package.json index 5ee7de4319..cab0a5f7ef 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/package.json +++ b/plugins/node/opentelemetry-instrumentation-fastify/package.json @@ -13,10 +13,11 @@ "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "fastify", From a75ac5095a25775887a0180a5d24bb226dfaf240 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 14:48:14 +0200 Subject: [PATCH 18/74] chore: add another round of instrumentations --- .../opentelemetry-instrumentation-generic-pool/package.json | 5 +++-- .../node/opentelemetry-instrumentation-graphql/package.json | 5 +++-- plugins/node/opentelemetry-instrumentation-hapi/package.json | 5 +++-- .../node/opentelemetry-instrumentation-ioredis/package.json | 5 +++-- plugins/node/opentelemetry-instrumentation-knex/package.json | 5 +++-- plugins/node/opentelemetry-instrumentation-koa/package.json | 5 +++-- .../opentelemetry-instrumentation-memcached/package.json | 5 +++-- .../node/opentelemetry-instrumentation-mongodb/package.json | 3 ++- .../node/opentelemetry-instrumentation-mysql/package.json | 5 +++-- .../node/opentelemetry-instrumentation-mysql2/package.json | 5 +++-- .../opentelemetry-instrumentation-nestjs-core/package.json | 5 +++-- plugins/node/opentelemetry-instrumentation-net/package.json | 5 +++-- .../node/opentelemetry-instrumentation-oracledb/package.json | 5 +++-- plugins/node/opentelemetry-instrumentation-pg/package.json | 5 +++-- 14 files changed, 41 insertions(+), 27 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-generic-pool/package.json b/plugins/node/opentelemetry-instrumentation-generic-pool/package.json index d37b16df81..33651ce31c 100644 --- a/plugins/node/opentelemetry-instrumentation-generic-pool/package.json +++ b/plugins/node/opentelemetry-instrumentation-generic-pool/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.ts'", + "test": "nyc --no-clean mocha 'test/**/*.ts'", "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", @@ -16,7 +16,8 @@ "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-generic-pool", "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "generic-pool", diff --git a/plugins/node/opentelemetry-instrumentation-graphql/package.json b/plugins/node/opentelemetry-instrumentation-graphql/package.json index 0276386db0..d58f00dabe 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/package.json +++ b/plugins/node/opentelemetry-instrumentation-graphql/package.json @@ -13,11 +13,12 @@ "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", "tdd": "npm run test -- --watch-extensions ts --watch", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "graphql", diff --git a/plugins/node/opentelemetry-instrumentation-hapi/package.json b/plugins/node/opentelemetry-instrumentation-hapi/package.json index 9641ae62ac..8e344d258b 100644 --- a/plugins/node/opentelemetry-instrumentation-hapi/package.json +++ b/plugins/node/opentelemetry-instrumentation-hapi/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", @@ -16,7 +16,8 @@ "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-hapi", "compile": "tsc -p .", - "prepublishOnly": "npm run compile" + "prepublishOnly": "npm run compile", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "hapi", diff --git a/plugins/node/opentelemetry-instrumentation-ioredis/package.json b/plugins/node/opentelemetry-instrumentation-ioredis/package.json index 80d32b5b85..53c97dc360 100644 --- a/plugins/node/opentelemetry-instrumentation-ioredis/package.json +++ b/plugins/node/opentelemetry-instrumentation-ioredis/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test:debug": "cross-env RUN_REDIS_TESTS_LOCAL=true mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "test:local": "cross-env RUN_REDIS_TESTS_LOCAL=true npm run test", "test-all-versions": "tav", @@ -19,7 +19,8 @@ "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-ioredis", "compile": "tsc -p .", - "prepublishOnly": "npm run compile" + "prepublishOnly": "npm run compile", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-knex/package.json b/plugins/node/opentelemetry-instrumentation-knex/package.json index 909d4f16f4..b84a6b1865 100644 --- a/plugins/node/opentelemetry-instrumentation-knex/package.json +++ b/plugins/node/opentelemetry-instrumentation-knex/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.ts'", + "test": "nyc --no-clean mocha 'test/**/*.ts'", "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", @@ -16,7 +16,8 @@ "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-knex", "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-koa/package.json b/plugins/node/opentelemetry-instrumentation-koa/package.json index bd64c70eb6..ced37ac3a4 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/package.json +++ b/plugins/node/opentelemetry-instrumentation-koa/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.ts'", + "test": "nyc --no-clean mocha 'test/**/*.ts'", "test-all-versions": "tav", "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", @@ -17,7 +17,8 @@ "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-koa", "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-memcached/package.json b/plugins/node/opentelemetry-instrumentation-memcached/package.json index 5c203fde8d..8c7373e103 100644 --- a/plugins/node/opentelemetry-instrumentation-memcached/package.json +++ b/plugins/node/opentelemetry-instrumentation-memcached/package.json @@ -13,10 +13,11 @@ "lint:fix": "eslint . --ext .ts --fix", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test:debug": "cross-env RUN_MEMCACHED_TESTS_LOCAL=true mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "test:local": "cross-env RUN_MEMCACHED_TESTS_LOCAL=true npm run test", - "version:update": "node ../../../scripts/version-update.js" + "version:update": "node ../../../scripts/version-update.js", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/package.json b/plugins/node/opentelemetry-instrumentation-mongodb/package.json index 0be1e11138..a0e6b14dd2 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/package.json +++ b/plugins/node/opentelemetry-instrumentation-mongodb/package.json @@ -24,7 +24,8 @@ "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-mongodb", "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "mongodb", diff --git a/plugins/node/opentelemetry-instrumentation-mysql/package.json b/plugins/node/opentelemetry-instrumentation-mysql/package.json index 908cb9c178..2d94667863 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql/package.json +++ b/plugins/node/opentelemetry-instrumentation-mysql/package.json @@ -13,8 +13,9 @@ "lint": "eslint . --ext .ts", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha 'test/**/*.test.ts'", - "version:update": "node ../../../scripts/version-update.js" + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "version:update": "node ../../../scripts/version-update.js", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/package.json b/plugins/node/opentelemetry-instrumentation-mysql2/package.json index adeccbe5f6..24af88ebae 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/package.json +++ b/plugins/node/opentelemetry-instrumentation-mysql2/package.json @@ -13,9 +13,10 @@ "lint": "eslint . --ext .ts", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", - "version:update": "node ../../../scripts/version-update.js" + "version:update": "node ../../../scripts/version-update.js", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json b/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json index 847497835d..79306fae68 100644 --- a/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json +++ b/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json @@ -14,10 +14,11 @@ "lint:fix": "eslint . --ext .ts --fix", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "npm run test-required-node-version && nyc mocha --timeout 5000 'test/**/*.test.ts' || echo 'Node version is not supported for testing'", + "test": "npm run test-required-node-version && nyc --no-clean mocha --timeout 5000 'test/**/*.test.ts' || echo 'Node version is not supported for testing'", "test-required-node-version": "node -e \"process.exit(parseInt(process.versions.node.split('.')[0], 10) >= 15 ? 0 : 1)\"", "test-all-versions": "tav", - "version:update": "node ../../../scripts/version-update.js" + "version:update": "node ../../../scripts/version-update.js", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-net/package.json b/plugins/node/opentelemetry-instrumentation-net/package.json index 094e86f13e..c0536b5b93 100644 --- a/plugins/node/opentelemetry-instrumentation-net/package.json +++ b/plugins/node/opentelemetry-instrumentation-net/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", @@ -15,7 +15,8 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-net", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "connect", diff --git a/plugins/node/opentelemetry-instrumentation-oracledb/package.json b/plugins/node/opentelemetry-instrumentation-oracledb/package.json index f0eb5a0b1d..74fb0d1abf 100644 --- a/plugins/node/opentelemetry-instrumentation-oracledb/package.json +++ b/plugins/node/opentelemetry-instrumentation-oracledb/package.json @@ -15,13 +15,14 @@ "prewatch": "npm run precompile", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", "test-all-versions:local": "cross-env RUN_ORACLEDB_TESTS_LOCAL=true npm run test-all-versions", "test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "test:local": "cross-env RUN_ORACLEDB_TESTS_LOCAL=true npm run test", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-pg/package.json b/plugins/node/opentelemetry-instrumentation-pg/package.json index 58d6d57db8..92f0a83946 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/package.json +++ b/plugins/node/opentelemetry-instrumentation-pg/package.json @@ -14,13 +14,14 @@ "lint:readme": "node ../../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", "test-all-versions:local": "cross-env RUN_POSTGRES_TESTS_LOCAL=true npm run test-all-versions", "test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "test:local": "cross-env RUN_POSTGRES_TESTS_LOCAL=true npm run test", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", From 48612c0b436f90fa6566c0807199dd705b5987e6 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 15:11:36 +0200 Subject: [PATCH 19/74] chore: add another chunk of instrumentations --- plugins/node/opentelemetry-instrumentation-pino/package.json | 5 +++-- .../node/opentelemetry-instrumentation-restify/package.json | 5 +++-- .../node/opentelemetry-instrumentation-router/package.json | 5 +++-- .../node/opentelemetry-instrumentation-winston/package.json | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-pino/package.json b/plugins/node/opentelemetry-instrumentation-pino/package.json index 5f7495a71a..4ccd4103de 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/package.json +++ b/plugins/node/opentelemetry-instrumentation-pino/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", @@ -16,7 +16,8 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-pino", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-restify/package.json b/plugins/node/opentelemetry-instrumentation-restify/package.json index 64b3748b87..d84422ac06 100644 --- a/plugins/node/opentelemetry-instrumentation-restify/package.json +++ b/plugins/node/opentelemetry-instrumentation-restify/package.json @@ -14,10 +14,11 @@ "lint:readme": "node ../../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", "tdd": "yarn test -- --watch-extensions ts --watch", - "test": "nyc mocha 'test/**/*.ts'", + "test": "nyc --no-clean mocha 'test/**/*.ts'", "test-all-versions": "tav", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-router/package.json b/plugins/node/opentelemetry-instrumentation-router/package.json index 6d4ff112d8..e2f0a61f64 100644 --- a/plugins/node/opentelemetry-instrumentation-router/package.json +++ b/plugins/node/opentelemetry-instrumentation-router/package.json @@ -6,7 +6,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "nyc mocha 'test/**/*.ts'", + "test": "nyc --no-clean mocha 'test/**/*.ts'", "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", @@ -16,7 +16,8 @@ "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-router", "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "watch": "tsc -w" + "watch": "tsc -w", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-winston/package.json b/plugins/node/opentelemetry-instrumentation-winston/package.json index c52d757cf9..1827adfbdc 100644 --- a/plugins/node/opentelemetry-instrumentation-winston/package.json +++ b/plugins/node/opentelemetry-instrumentation-winston/package.json @@ -19,7 +19,8 @@ "prepublishOnly": "npm run compile", "version:update": "node ../../../scripts/version-update.js", "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-winston", - "compile": "tsc -p ." + "compile": "tsc -p .", + "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "instrumentation", From ddca5a1416296b56e1a6ab4fd9ca0897424b3eca Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 12 Jun 2025 17:09:57 +0200 Subject: [PATCH 20/74] chore: add codecov action with dry_run --- .github/workflows/pr-test.yml | 13 +- codecov.yml | 285 +++++++++++++++++- .../.tav.yml | 8 +- .../package.json | 5 +- .../package.json | 5 +- 5 files changed, 289 insertions(+), 27 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 7956e4a490..37ea2df347 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -234,12 +234,13 @@ jobs: - name: Check coverage run: find . | grep coverage-final - # - name: Report Coverage - # uses: codecov/codecov-action@v5 - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # with: - # verbose: true + - name: Report Coverage + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + verbose: true + dry_run: true # browser-test: # needs: build-and-cache diff --git a/codecov.yml b/codecov.yml index 1beb17b8de..bb6cc2a702 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,15 +1,278 @@ codecov: notify: - require_ci_to_pass: no + after_n_builds: 1 + require_ci_to_pass: no comment: - layout: "header, changes, diff, files" + layout: 'header, changes, diff, files' behavior: default -coverage: - status: - patch: - default: - target: 80% - project: - default: - target: auto - threshold: 1% +# We set the flags manually to have better control of it +# ref: https://docs.codecov.com/docs/flags#advanced-bespoke-flag-management +flags: + winston-transport: + paths: + - packages/winston-transport/ + carryforward: true + contrib-test-utils: + paths: + - packages/opentelemetry-test-utils/ + carryforward: true + sql-common: + paths: + - packages/opentelemetry-sql-common/ + carryforward: true + redis-common: + paths: + - packages/opentelemetry-redis-common/ + carryforward: true + propagation-utils: + paths: + - packages/opentelemetry-propagation-utils/ + carryforward: true + id-generator-aws-xray: + paths: + - packages/opentelemetry-id-generator-aws-xray/ + carryforward: true + host-metrics: + paths: + - packages/opentelemetry-host-metrics/ + carryforward: true + baggage-span-processor: + paths: + - packages/baggage-span-processor/ + carryforward: true + baggage-log-record-processor: + paths: + - packages/baggage-log-record-processor/ + carryforward: true + instrumentation-winston: + paths: + - plugins/node/opentelemetry-instrumentation-winston/ + carryforward: true + instrumentation-router: + paths: + - plugins/node/opentelemetry-instrumentation-router/ + carryforward: true + instrumentation-restify: + paths: + - plugins/node/opentelemetry-instrumentation-restify/ + carryforward: true + instrumentation-redis-4: + paths: + - plugins/node/opentelemetry-instrumentation-redis-4/ + carryforward: true + instrumentation-redis: + paths: + - plugins/node/opentelemetry-instrumentation-redis/ + carryforward: true + instrumentation-pino: + paths: + - plugins/node/opentelemetry-instrumentation-pino/ + carryforward: true + instrumentation-pg: + paths: + - plugins/node/opentelemetry-instrumentation-pg/ + carryforward: true + instrumentation-oracledb: + paths: + - plugins/node/opentelemetry-instrumentation-oracledb/ + carryforward: true + instrumentation-net: + paths: + - plugins/node/opentelemetry-instrumentation-net/ + carryforward: true + instrumentation-nestjs-core: + paths: + - plugins/node/opentelemetry-instrumentation-nestjs-core/ + carryforward: true + instrumentation-mysql2: + paths: + - plugins/node/opentelemetry-instrumentation-mysql2/ + carryforward: true + instrumentation-mysql: + paths: + - plugins/node/opentelemetry-instrumentation-mysql/ + carryforward: true + instrumentation-mongodb: + paths: + - plugins/node/opentelemetry-instrumentation-mongodb/ + carryforward: true + instrumentation-memcached: + paths: + - plugins/node/opentelemetry-instrumentation-memcached/ + carryforward: true + instrumentation-koa: + paths: + - plugins/node/opentelemetry-instrumentation-koa/ + carryforward: true + instrumentation-knex: + paths: + - plugins/node/opentelemetry-instrumentation-knex/ + carryforward: true + instrumentation-ioredis: + paths: + - plugins/node/opentelemetry-instrumentation-ioredis/ + carryforward: true + instrumentation-hapi: + paths: + - plugins/node/opentelemetry-instrumentation-hapi/ + carryforward: true + instrumentation-graphql: + paths: + - plugins/node/opentelemetry-instrumentation-graphql/ + carryforward: true + instrumentation-generic-pool: + paths: + - plugins/node/opentelemetry-instrumentation-generic-pool/ + carryforward: true + instrumentation-fastify: + paths: + - plugins/node/opentelemetry-instrumentation-fastify/ + carryforward: true + instrumentation-express: + paths: + - plugins/node/opentelemetry-instrumentation-express/ + carryforward: true + instrumentation-dns: + paths: + - plugins/node/opentelemetry-instrumentation-dns/ + carryforward: true + instrumentation-connect: + paths: + - plugins/node/opentelemetry-instrumentation-connect/ + carryforward: true + instrumentation-cassandra-driver: + paths: + - plugins/node/opentelemetry-instrumentation-cassandra/ + carryforward: true + instrumentation-bunyan: + paths: + - plugins/node/opentelemetry-instrumentation-bunyan/ + carryforward: true + instrumentation-aws-sdk: + paths: + - plugins/node/opentelemetry-instrumentation-aws-sdk/ + carryforward: true + instrumentation-aws-lambda: + paths: + - plugins/node/opentelemetry-instrumentation-aws-lambda/ + carryforward: true + instrumentation-undici: + paths: + - plugins/node/instrumentation-undici/ + carryforward: true + instrumentation-typeorm: + paths: + - plugins/node/instrumentation-typeorm/ + carryforward: true + instrumentation-tedious: + paths: + - plugins/node/instrumentation-tedious/ + carryforward: true + instrumentation-socket.io: + paths: + - plugins/node/instrumentation-socket.io/ + carryforward: true + instrumentation-runtime-node: + paths: + - plugins/node/instrumentation-runtime-node/ + carryforward: true + instrumentation-mongoose: + paths: + - plugins/node/instrumentation-mongoose/ + carryforward: true + instrumentation-lru-memoizer: + paths: + - plugins/node/instrumentation-lru-memoizer/ + carryforward: true + instrumentation-kafkajs: + paths: + - plugins/node/instrumentation-kafkajs/ + carryforward: true + instrumentation-fs: + paths: + - plugins/node/instrumentation-fs/ + carryforward: true + instrumentation-dataloader: + paths: + - plugins/node/instrumentation-dataloader/ + carryforward: true + instrumentation-cucumber: + paths: + - plugins/node/instrumentation-cucumber/ + carryforward: true + instrumentation-amqplib: + paths: + - plugins/node/instrumentation-amqplib/ + carryforward: true + plugin-react-load: + paths: + - plugins/web/opentelemetry-plugin-react-load/ + carryforward: true + instrumentation-user-interaction: + paths: + - plugins/web/opentelemetry-instrumentation-user-interaction/ + carryforward: true + instrumentation-long-task: + paths: + - plugins/web/opentelemetry-instrumentation-long-task/ + carryforward: true + instrumentation-document-load: + paths: + - plugins/web/opentelemetry-instrumentation-document-load/ + carryforward: true + propagator-aws-xray-lambda: + paths: + - propagators/propagator-aws-xray-lambda/ + carryforward: true + propagator-aws-xray: + paths: + - propagators/propagator-aws-xray/ + carryforward: true + propagator-ot-trace: + paths: + - propagators/opentelemetry-propagator-ot-trace/ + carryforward: true + propagator-instana: + paths: + - propagators/opentelemetry-propagator-instana/ + carryforward: true + resource-detector-instana: + paths: + - detectors/node/opentelemetry-resource-detector-instana/ + carryforward: true + resource-detector-github: + paths: + - detectors/node/opentelemetry-resource-detector-github/ + carryforward: true + resource-detector-gcp: + paths: + - detectors/node/opentelemetry-resource-detector-gcp/ + carryforward: true + resource-detector-container: + paths: + - detectors/node/opentelemetry-resource-detector-container/ + carryforward: true + resource-detector-azure: + paths: + - detectors/node/opentelemetry-resource-detector-azure/ + carryforward: true + resource-detector-aws: + paths: + - detectors/node/opentelemetry-resource-detector-aws/ + carryforward: true + resource-detector-alibaba-cloud: + paths: + - detectors/node/opentelemetry-resource-detector-alibaba-cloud/ + carryforward: true + auto-instrumentations-web: + paths: + - metapackages/auto-instrumentations-web/ + carryforward: true + auto-instrumentations-node: + paths: + - metapackages/auto-instrumentations-node/ + carryforward: true + auto-configuration-propagators: + paths: + - metapackages/auto-configuration-propagators/ + carryforward: true diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml index 3fea9b90b3..0ec6e8b36b 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml @@ -12,7 +12,7 @@ exclude: ">=3.363.0 <=3.377.0" mode: "max-7" commands: - - nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' test/bedrock-runtime.test.ts + - mocha --require '@opentelemetry/contrib-test-utils' test/bedrock-runtime.test.ts "@aws-sdk/client-s3": env: @@ -25,8 +25,8 @@ exclude: "3.529.0 || >=3.363.0 <=3.377.0" mode: "max-7" commands: - - nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-s3.test.ts - - nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' test/s3.test.ts + - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-s3.test.ts + - mocha --require '@opentelemetry/contrib-test-utils' test/s3.test.ts "@aws-sdk/client-sqs": env: @@ -38,4 +38,4 @@ exclude: ">=3.363.0 <=3.377.0" mode: "max-7" commands: - - nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-sqs.test.ts + - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-sqs.test.ts diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json index c4a30acac7..ba1a8b2d9a 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json @@ -35,11 +35,10 @@ "lint:readme": "node ../../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "watch": "tsc -w" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" diff --git a/plugins/node/opentelemetry-instrumentation-pg/package.json b/plugins/node/opentelemetry-instrumentation-pg/package.json index 92f0a83946..58d6d57db8 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/package.json +++ b/plugins/node/opentelemetry-instrumentation-pg/package.json @@ -14,14 +14,13 @@ "lint:readme": "node ../../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "test": "nyc mocha 'test/**/*.test.ts'", "test-all-versions": "tav", "test-all-versions:local": "cross-env RUN_POSTGRES_TESTS_LOCAL=true npm run test-all-versions", "test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "test:local": "cross-env RUN_POSTGRES_TESTS_LOCAL=true npm run test", "version:update": "node ../../../scripts/version-update.js", - "watch": "tsc -w", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "watch": "tsc -w" }, "keywords": [ "instrumentation", From 855e679a6e0cca522ce505c2c89ee4d59760a7ad Mon Sep 17 00:00:00 2001 From: David Luna Date: Fri, 13 Jun 2025 10:50:54 +0200 Subject: [PATCH 21/74] chore: add flags script --- .github/workflows/pr-test.yml | 80 ++++++++++++++++---------------- scripts/codecov-upload-flags.mjs | 26 +++++++++++ 2 files changed, 66 insertions(+), 40 deletions(-) create mode 100644 scripts/codecov-upload-flags.mjs diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 37ea2df347..a8032ed252 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -5,7 +5,7 @@ on: branches: [main] jobs: - build-and-cache: + compile: strategy: fail-fast: false runs-on: ubuntu-latest @@ -29,14 +29,14 @@ jobs: - name: Upload Build Artifacts uses: actions/upload-artifact@v4 with: - name: tests-build-cache-${{ github.run_number }} + name: compile-cache-${{ github.run_number }} path: .nx include-hidden-files: true if-no-files-found: error retention-days: 1 unit-and-tav-test: - needs: build-and-cache + needs: compile strategy: fail-fast: false matrix: @@ -181,7 +181,7 @@ jobs: - name: Download Build Artifacts uses: actions/download-artifact@v4 with: - name: tests-build-cache-${{ github.run_number }} + name: compile-cache-${{ github.run_number }} path: .nx - name: Compile (Delta) run: npm run compile:ci:affected @@ -200,6 +200,42 @@ jobs: !node_modules **/.nyc_output/** + browser-test: + needs: compile + strategy: + fail-fast: false + matrix: + node: ["22"] + runs-on: ubuntu-latest + env: + NPM_CONFIG_UNSAFE_PERM: true + NODE_OPTIONS: --max-old-space-size=4096 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - name: Install + run: npm ci + - name: Download Build Artifacts + uses: actions/download-artifact@v4 + with: + name: tests-build-cache-${{ github.run_number }} + path: .nx + - name: Build + run: npm run compile + - name: Unit tests + run: npm run test:browser + - name: Report Coverage + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + verbose: true + test-coverage-report: runs-on: ubuntu-latest needs: unit-and-tav-test @@ -241,39 +277,3 @@ jobs: with: verbose: true dry_run: true - - # browser-test: - # needs: build-and-cache - # strategy: - # fail-fast: false - # matrix: - # node: ["22"] - # runs-on: ubuntu-latest - # env: - # NPM_CONFIG_UNSAFE_PERM: true - # NODE_OPTIONS: --max-old-space-size=4096 - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - # - uses: actions/setup-node@v4 - # with: - # node-version: ${{ matrix.node }} - # - name: Install - # run: npm ci - # - name: Download Build Artifacts - # uses: actions/download-artifact@v4 - # with: - # name: tests-build-cache-${{ github.run_number }} - # path: .nx - # - name: Build - # run: npm run compile - # - name: Unit tests - # run: npm run test:browser - # - name: Report Coverage - # uses: codecov/codecov-action@v5 - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # with: - # verbose: true diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs new file mode 100644 index 0000000000..1420f559ec --- /dev/null +++ b/scripts/codecov-upload-flags.mjs @@ -0,0 +1,26 @@ +import path from 'path'; +import { readFileSync } from 'fs'; +import { globSync } from 'glob'; + +const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); + +const TOP = process.cwd(); +const pkgInfo = readPkg(TOP); +const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); +const pkgFlags = pkgFiles.flat().map((f) => { + const path = f.replace('package.json', ''); + const info = readPkg(path); + const name = info.name; + const flag = name.replace('@opentelemetry/', ''); + + return { name, flag, len: flag.length, path }; +}); + +// Print the flags +pkgFlags.forEach((pf) => { + console.log(` + ${pf.flag}: + paths: + - ${pf.path} + carryforward: true`) +}); \ No newline at end of file From d8068beb44c14102285f19a06d79cadf1b3f18d2 Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 8 Jul 2025 19:13:43 +0200 Subject: [PATCH 22/74] chore: update codecov.yml --- codecov.yml | 116 ++++++++++++++++++++++++++-------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/codecov.yml b/codecov.yml index bb6cc2a702..e0f5e96dae 100644 --- a/codecov.yml +++ b/codecov.yml @@ -46,233 +46,233 @@ flags: carryforward: true instrumentation-winston: paths: - - plugins/node/opentelemetry-instrumentation-winston/ + - packages/instrumentation-winston/ carryforward: true instrumentation-router: paths: - - plugins/node/opentelemetry-instrumentation-router/ + - packages/instrumentation-router/ carryforward: true instrumentation-restify: paths: - - plugins/node/opentelemetry-instrumentation-restify/ + - packages/instrumentation-restify/ carryforward: true instrumentation-redis-4: paths: - - plugins/node/opentelemetry-instrumentation-redis-4/ + - packages/instrumentation-redis-4/ carryforward: true instrumentation-redis: paths: - - plugins/node/opentelemetry-instrumentation-redis/ + - packages/instrumentation-redis/ carryforward: true instrumentation-pino: paths: - - plugins/node/opentelemetry-instrumentation-pino/ + - packages/instrumentation-pino/ carryforward: true instrumentation-pg: paths: - - plugins/node/opentelemetry-instrumentation-pg/ + - packages/instrumentation-pg/ carryforward: true instrumentation-oracledb: paths: - - plugins/node/opentelemetry-instrumentation-oracledb/ + - packages/instrumentation-oracledb/ carryforward: true instrumentation-net: paths: - - plugins/node/opentelemetry-instrumentation-net/ + - packages/instrumentation-net/ carryforward: true instrumentation-nestjs-core: paths: - - plugins/node/opentelemetry-instrumentation-nestjs-core/ + - packages/instrumentation-nestjs-core/ carryforward: true instrumentation-mysql2: paths: - - plugins/node/opentelemetry-instrumentation-mysql2/ + - packages/instrumentation-mysql2/ carryforward: true instrumentation-mysql: paths: - - plugins/node/opentelemetry-instrumentation-mysql/ + - packages/instrumentation-mysql/ carryforward: true instrumentation-mongodb: paths: - - plugins/node/opentelemetry-instrumentation-mongodb/ + - packages/instrumentation-mongodb/ carryforward: true instrumentation-memcached: paths: - - plugins/node/opentelemetry-instrumentation-memcached/ + - packages/instrumentation-memcached/ carryforward: true instrumentation-koa: paths: - - plugins/node/opentelemetry-instrumentation-koa/ + - packages/instrumentation-koa/ carryforward: true instrumentation-knex: paths: - - plugins/node/opentelemetry-instrumentation-knex/ + - packages/instrumentation-knex/ carryforward: true instrumentation-ioredis: paths: - - plugins/node/opentelemetry-instrumentation-ioredis/ + - packages/instrumentation-ioredis/ carryforward: true instrumentation-hapi: paths: - - plugins/node/opentelemetry-instrumentation-hapi/ + - packages/instrumentation-hapi/ carryforward: true instrumentation-graphql: paths: - - plugins/node/opentelemetry-instrumentation-graphql/ + - packages/instrumentation-graphql/ carryforward: true instrumentation-generic-pool: paths: - - plugins/node/opentelemetry-instrumentation-generic-pool/ + - packages/instrumentation-generic-pool/ carryforward: true instrumentation-fastify: paths: - - plugins/node/opentelemetry-instrumentation-fastify/ + - packages/instrumentation-fastify/ carryforward: true instrumentation-express: paths: - - plugins/node/opentelemetry-instrumentation-express/ + - packages/instrumentation-express/ carryforward: true instrumentation-dns: paths: - - plugins/node/opentelemetry-instrumentation-dns/ + - packages/instrumentation-dns/ carryforward: true instrumentation-connect: paths: - - plugins/node/opentelemetry-instrumentation-connect/ + - packages/instrumentation-connect/ carryforward: true instrumentation-cassandra-driver: paths: - - plugins/node/opentelemetry-instrumentation-cassandra/ + - packages/instrumentation-cassandra/ carryforward: true instrumentation-bunyan: paths: - - plugins/node/opentelemetry-instrumentation-bunyan/ + - packages/instrumentation-bunyan/ carryforward: true instrumentation-aws-sdk: paths: - - plugins/node/opentelemetry-instrumentation-aws-sdk/ + - packages/instrumentation-aws-sdk/ carryforward: true instrumentation-aws-lambda: paths: - - plugins/node/opentelemetry-instrumentation-aws-lambda/ + - packages/instrumentation-aws-lambda/ carryforward: true instrumentation-undici: paths: - - plugins/node/instrumentation-undici/ + - packages/instrumentation-undici/ carryforward: true instrumentation-typeorm: paths: - - plugins/node/instrumentation-typeorm/ + - packages/instrumentation-typeorm/ carryforward: true instrumentation-tedious: paths: - - plugins/node/instrumentation-tedious/ + - packages/instrumentation-tedious/ carryforward: true instrumentation-socket.io: paths: - - plugins/node/instrumentation-socket.io/ + - packages/instrumentation-socket.io/ carryforward: true instrumentation-runtime-node: paths: - - plugins/node/instrumentation-runtime-node/ + - packages/instrumentation-runtime-node/ carryforward: true instrumentation-mongoose: paths: - - plugins/node/instrumentation-mongoose/ + - packages/instrumentation-mongoose/ carryforward: true instrumentation-lru-memoizer: paths: - - plugins/node/instrumentation-lru-memoizer/ + - packages/instrumentation-lru-memoizer/ carryforward: true instrumentation-kafkajs: paths: - - plugins/node/instrumentation-kafkajs/ + - packages/instrumentation-kafkajs/ carryforward: true instrumentation-fs: paths: - - plugins/node/instrumentation-fs/ + - packages/instrumentation-fs/ carryforward: true instrumentation-dataloader: paths: - - plugins/node/instrumentation-dataloader/ + - packages/instrumentation-dataloader/ carryforward: true instrumentation-cucumber: paths: - - plugins/node/instrumentation-cucumber/ + - packages/instrumentation-cucumber/ carryforward: true instrumentation-amqplib: paths: - - plugins/node/instrumentation-amqplib/ + - packages/instrumentation-amqplib/ carryforward: true plugin-react-load: paths: - - plugins/web/opentelemetry-plugin-react-load/ + - packages/plugin-react-load/ carryforward: true instrumentation-user-interaction: paths: - - plugins/web/opentelemetry-instrumentation-user-interaction/ + - packages/instrumentation-user-interaction/ carryforward: true instrumentation-long-task: paths: - - plugins/web/opentelemetry-instrumentation-long-task/ + - packages/instrumentation-long-task/ carryforward: true instrumentation-document-load: paths: - - plugins/web/opentelemetry-instrumentation-document-load/ + - packages/instrumentation-document-load/ carryforward: true propagator-aws-xray-lambda: paths: - - propagators/propagator-aws-xray-lambda/ + - packages/propagator-aws-xray-lambda/ carryforward: true propagator-aws-xray: paths: - - propagators/propagator-aws-xray/ + - packages/propagator-aws-xray/ carryforward: true propagator-ot-trace: paths: - - propagators/opentelemetry-propagator-ot-trace/ + - packages/opentelemetry-propagator-ot-trace/ carryforward: true propagator-instana: paths: - - propagators/opentelemetry-propagator-instana/ + - packages/opentelemetry-propagator-instana/ carryforward: true resource-detector-instana: paths: - - detectors/node/opentelemetry-resource-detector-instana/ + - packages/resource-detector-instana/ carryforward: true resource-detector-github: paths: - - detectors/node/opentelemetry-resource-detector-github/ + - packages/resource-detector-github/ carryforward: true resource-detector-gcp: paths: - - detectors/node/opentelemetry-resource-detector-gcp/ + - packages/resource-detector-gcp/ carryforward: true resource-detector-container: paths: - - detectors/node/opentelemetry-resource-detector-container/ + - packages/resource-detector-container/ carryforward: true resource-detector-azure: paths: - - detectors/node/opentelemetry-resource-detector-azure/ + - packages/resource-detector-azure/ carryforward: true resource-detector-aws: paths: - - detectors/node/opentelemetry-resource-detector-aws/ + - packages/resource-detector-aws/ carryforward: true resource-detector-alibaba-cloud: paths: - - detectors/node/opentelemetry-resource-detector-alibaba-cloud/ + - packages/resource-detector-alibaba-cloud/ carryforward: true auto-instrumentations-web: paths: - - metapackages/auto-instrumentations-web/ + - packages/auto-instrumentations-web/ carryforward: true auto-instrumentations-node: paths: - - metapackages/auto-instrumentations-node/ + - packages/auto-instrumentations-node/ carryforward: true auto-configuration-propagators: paths: - - metapackages/auto-configuration-propagators/ + - packages/auto-configuration-packages/ carryforward: true From 444bee8072e0ca1cdf82c5cbd551fa22a86c8629 Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 8 Jul 2025 22:23:39 +0200 Subject: [PATCH 23/74] chore: rename job to match PR checks --- .github/workflows/pr-test.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 14e118efff..fef2ef5de3 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -35,7 +35,7 @@ jobs: if-no-files-found: error retention-days: 1 - unit-and-tav-test: + unit-test: needs: compile strategy: fail-fast: false @@ -221,7 +221,7 @@ jobs: - name: Download Build Artifacts uses: actions/download-artifact@v4 with: - name: tests-build-cache-${{ github.run_number }} + name: compile-cache-${{ github.run_number }} path: .nx - name: Build run: npm run compile @@ -236,7 +236,7 @@ jobs: test-coverage-report: runs-on: ubuntu-latest - needs: unit-and-tav-test + needs: unit-test steps: - name: Checkout uses: actions/checkout@v4 @@ -247,17 +247,28 @@ jobs: node-version: 18 - name: Install run: npm ci - # TODO: add the rest of versions (18.19.0 & 20.6.0)? or are these enough?? + # NOTE: keep this in sync with the node versions from `unit-test` job + # TODO: doownload browser coverage - name: Download Test Artifacts (18) uses: actions/download-artifact@v4 with: name: tests-coverage-cache-${{ github.run_number }}-18 path: . + - name: Download Test Artifacts (18.19.0) + uses: actions/download-artifact@v4 + with: + name: tests-coverage-cache-${{ github.run_number }}-18.19.0 + path: . - name: Download Test Artifacts (20) uses: actions/download-artifact@v4 with: name: tests-coverage-cache-${{ github.run_number }}-20 path: . + - name: Download Test Artifacts (20.6.0) + uses: actions/download-artifact@v4 + with: + name: tests-coverage-cache-${{ github.run_number }}-20.6.0 + path: . - name: Download Test Artifacts (22) uses: actions/download-artifact@v4 with: From 325737025c6ccddecee719a4a167b642f9e19125 Mon Sep 17 00:00:00 2001 From: David Luna Date: Fri, 1 Aug 2025 13:35:18 +0200 Subject: [PATCH 24/74] chore: rename coverage script --- packages/instrumentation-amqplib/package.json | 5 ++--- packages/instrumentation-aws-lambda/package.json | 13 ++++++------- packages/instrumentation-bunyan/package.json | 4 ++-- .../package.json | 2 +- packages/instrumentation-connect/package.json | 2 +- packages/instrumentation-dataloader/package.json | 2 +- packages/instrumentation-dns/package.json | 14 +++++++------- packages/instrumentation-express/package.json | 16 ++++++++-------- packages/instrumentation-fastify/package.json | 2 +- .../instrumentation-generic-pool/package.json | 14 +++++++------- packages/instrumentation-graphql/package.json | 6 +++--- packages/instrumentation-hapi/package.json | 14 +++++++------- packages/instrumentation-kafkajs/package.json | 14 +++++++------- packages/instrumentation-knex/package.json | 2 +- packages/instrumentation-koa/package.json | 2 +- .../instrumentation-lru-memoizer/package.json | 4 ++-- packages/instrumentation-memcached/package.json | 2 +- packages/instrumentation-mongodb/package.json | 2 +- packages/instrumentation-mysql/package.json | 2 +- packages/instrumentation-mysql2/package.json | 2 +- .../instrumentation-nestjs-core/package.json | 4 ++-- packages/instrumentation-net/package.json | 2 +- packages/instrumentation-oracledb/package.json | 4 ++-- packages/instrumentation-pino/package.json | 14 +++++++------- packages/instrumentation-restify/package.json | 6 +++--- packages/instrumentation-router/package.json | 14 +++++++------- .../instrumentation-runtime-node/package.json | 4 ++-- packages/instrumentation-socket.io/package.json | 14 +++++++------- packages/instrumentation-tedious/package.json | 2 +- packages/instrumentation-typeorm/package.json | 4 ++-- packages/instrumentation-undici/package.json | 4 ++-- packages/instrumentation-winston/package.json | 2 +- 32 files changed, 98 insertions(+), 100 deletions(-) diff --git a/packages/instrumentation-amqplib/package.json b/packages/instrumentation-amqplib/package.json index a5b4d2706b..46ce856634 100644 --- a/packages/instrumentation-amqplib/package.json +++ b/packages/instrumentation-amqplib/package.json @@ -42,12 +42,11 @@ "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test", "test-all-versions": "tav", "test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "test-services:start": "cd ../.. && npm run test-services:start rabbitmq", "test-services:stop": "cd ../.. && npm run test-services:stop rabbitmq", "version:update": "node ../../scripts/version-update.js", - "watch": "tsc -w", - "test:docker:run": "docker run -d --hostname demo-amqplib-rabbit --name amqplib-unittests -p 22221:5672 --env RABBITMQ_DEFAULT_USER=username --env RABBITMQ_DEFAULT_PASS=password rabbitmq:3", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "watch": "tsc -w" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" diff --git a/packages/instrumentation-aws-lambda/package.json b/packages/instrumentation-aws-lambda/package.json index 007815c14a..55478df52e 100644 --- a/packages/instrumentation-aws-lambda/package.json +++ b/packages/instrumentation-aws-lambda/package.json @@ -10,18 +10,17 @@ "directory": "packages/instrumentation-aws-lambda" }, "scripts": { - "test": "nyc --no-clean mocha 'test/**/*.test.ts'", - "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-aws-lambda", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "version:update": "node ../../scripts/version-update.js", - "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-aws-lambda", - "compile": "tsc -p .", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-aws-lambda", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "tdd": "npm run test -- --watch-extensions ts --watch", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", + "version:update": "node ../../scripts/version-update.js" }, "keywords": [ "aws-lambda", diff --git a/packages/instrumentation-bunyan/package.json b/packages/instrumentation-bunyan/package.json index 680064442e..391eab5f48 100644 --- a/packages/instrumentation-bunyan/package.json +++ b/packages/instrumentation-bunyan/package.json @@ -11,15 +11,15 @@ }, "scripts": { "clean": "rimraf build/*", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-bunyan", "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-bunyan", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js" }, "keywords": [ diff --git a/packages/instrumentation-cassandra-driver/package.json b/packages/instrumentation-cassandra-driver/package.json index e591065a4b..092f67bfe8 100644 --- a/packages/instrumentation-cassandra-driver/package.json +++ b/packages/instrumentation-cassandra-driver/package.json @@ -22,9 +22,9 @@ "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test", "//todo": "echo \"add test-all-versions\"", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "test-services:start": "cd ../.. && npm run test-services:start cassandra", "test-services:stop": "cd ../.. && npm run test-services:stop cassandra", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js" }, "keywords": [ diff --git a/packages/instrumentation-connect/package.json b/packages/instrumentation-connect/package.json index fcc7f84821..687d95550a 100644 --- a/packages/instrumentation-connect/package.json +++ b/packages/instrumentation-connect/package.json @@ -17,8 +17,8 @@ "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" }, diff --git a/packages/instrumentation-dataloader/package.json b/packages/instrumentation-dataloader/package.json index 686f9cd542..e582dfcad3 100644 --- a/packages/instrumentation-dataloader/package.json +++ b/packages/instrumentation-dataloader/package.json @@ -19,7 +19,7 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js" }, "keywords": [ diff --git a/packages/instrumentation-dns/package.json b/packages/instrumentation-dns/package.json index 91680cda02..02c76ee053 100644 --- a/packages/instrumentation-dns/package.json +++ b/packages/instrumentation-dns/package.json @@ -10,17 +10,17 @@ "directory": "packages/instrumentation-dns" }, "scripts": { - "test": "nyc --no-clean mocha 'test/**/*.test.ts'", - "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-dns", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "prepublishOnly": "npm run compile", - "version:update": "node ../../scripts/version-update.js", "lint:readme": "node ../../scripts/lint-readme", - "compile": "tsc -p .", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-dns", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "prepublishOnly": "npm run compile", + "tdd": "npm run test -- --watch-extensions ts --watch", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", + "version:update": "node ../../scripts/version-update.js" }, "keywords": [ "dns", diff --git a/packages/instrumentation-express/package.json b/packages/instrumentation-express/package.json index 4418c3ad8c..1c54ccf5b5 100644 --- a/packages/instrumentation-express/package.json +++ b/packages/instrumentation-express/package.json @@ -10,19 +10,19 @@ "directory": "packages/instrumentation-express" }, "scripts": { - "test-all-versions": "tav", - "test": "nyc --no-clean mocha 'test/**/*.test.ts'", - "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-express", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", - "version:update": "node ../../scripts/version-update.js", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-express", - "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "watch": "tsc -w", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "tdd": "yarn test -- --watch-extensions ts --watch", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "test-all-versions": "tav", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", + "version:update": "node ../../scripts/version-update.js", + "watch": "tsc -w" }, "keywords": [ "express", diff --git a/packages/instrumentation-fastify/package.json b/packages/instrumentation-fastify/package.json index ea854b941e..448e11115c 100644 --- a/packages/instrumentation-fastify/package.json +++ b/packages/instrumentation-fastify/package.json @@ -19,7 +19,7 @@ "prepublishOnly": "npm run compile", "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" }, diff --git a/packages/instrumentation-generic-pool/package.json b/packages/instrumentation-generic-pool/package.json index e567c5356d..1efcff7908 100644 --- a/packages/instrumentation-generic-pool/package.json +++ b/packages/instrumentation-generic-pool/package.json @@ -10,18 +10,18 @@ "directory": "packages/instrumentation-generic-pool" }, "scripts": { - "test": "nyc --no-clean mocha 'test/**/*.ts'", - "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-generic-pool", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", - "version:update": "node ../../scripts/version-update.js", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-generic-pool", - "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "watch": "tsc -w", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "tdd": "yarn test -- --watch-extensions ts --watch", + "test": "nyc --no-clean mocha 'test/**/*.ts'", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", + "version:update": "node ../../scripts/version-update.js", + "watch": "tsc -w" }, "keywords": [ "generic-pool", diff --git a/packages/instrumentation-graphql/package.json b/packages/instrumentation-graphql/package.json index 84b1d7a30c..f0c965b8cd 100644 --- a/packages/instrumentation-graphql/package.json +++ b/packages/instrumentation-graphql/package.json @@ -11,16 +11,16 @@ }, "scripts": { "clean": "rimraf build/*", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-graphql", "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-graphql", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", + "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test-all-versions": "tav", - "tdd": "npm run test -- --watch-extensions ts --watch", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" }, diff --git a/packages/instrumentation-hapi/package.json b/packages/instrumentation-hapi/package.json index 078c7a8929..278c35cdf1 100644 --- a/packages/instrumentation-hapi/package.json +++ b/packages/instrumentation-hapi/package.json @@ -10,18 +10,18 @@ "directory": "packages/instrumentation-hapi" }, "scripts": { - "test": "nyc --no-clean mocha 'test/**/*.test.ts'", - "test-all-versions": "tav", - "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-hapi", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", - "version:update": "node ../../scripts/version-update.js", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-hapi", - "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "tdd": "npm test -- --watch-extensions ts --watch", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "test-all-versions": "tav", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", + "version:update": "node ../../scripts/version-update.js" }, "keywords": [ "hapi", diff --git a/packages/instrumentation-kafkajs/package.json b/packages/instrumentation-kafkajs/package.json index fd7ac7eb30..5996449536 100644 --- a/packages/instrumentation-kafkajs/package.json +++ b/packages/instrumentation-kafkajs/package.json @@ -10,18 +10,18 @@ "directory": "packages/instrumentation-kafkajs" }, "scripts": { - "test": "nyc --no-clean mocha --require @opentelemetry/contrib-test-utils 'test/**/*.test.ts'", - "test-all-versions": "tav", - "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-kafkajs", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme", "prepublishOnly": "npm run compile", - "version:update": "node ../../scripts/version-update.js", - "compile": "tsc -p .", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-kafkajs", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "tdd": "npm run test -- --watch-extensions ts --watch", + "test": "nyc --no-clean mocha --require @opentelemetry/contrib-test-utils 'test/**/*.test.ts'", + "test-all-versions": "tav", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", + "version:update": "node ../../scripts/version-update.js" }, "keywords": [ "kafkajs", diff --git a/packages/instrumentation-knex/package.json b/packages/instrumentation-knex/package.json index e915cd80fe..8f3505d366 100644 --- a/packages/instrumentation-knex/package.json +++ b/packages/instrumentation-knex/package.json @@ -17,9 +17,9 @@ "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme", "prepublishOnly": "npm run compile", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc mocha 'test/**/*.ts'", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "//todo": "echo \"add test-all-versions\"", "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" diff --git a/packages/instrumentation-koa/package.json b/packages/instrumentation-koa/package.json index 8e4d05aafd..f29bef89c4 100644 --- a/packages/instrumentation-koa/package.json +++ b/packages/instrumentation-koa/package.json @@ -17,10 +17,10 @@ "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc --no-clean mocha 'test/**/*.ts'", "test-all-versions": "tav", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" }, diff --git a/packages/instrumentation-lru-memoizer/package.json b/packages/instrumentation-lru-memoizer/package.json index a7255f9784..f4a92e51f3 100644 --- a/packages/instrumentation-lru-memoizer/package.json +++ b/packages/instrumentation-lru-memoizer/package.json @@ -17,10 +17,10 @@ "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", - "tdd": "npm run test -- --watch-extensions ts --watch", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js" }, "keywords": [ diff --git a/packages/instrumentation-memcached/package.json b/packages/instrumentation-memcached/package.json index d940b5bce7..bc76ead31f 100644 --- a/packages/instrumentation-memcached/package.json +++ b/packages/instrumentation-memcached/package.json @@ -20,7 +20,7 @@ "test": "nyc mocha 'test/**/*.test.ts'", "test:debug": "cross-env RUN_MEMCACHED_TESTS=true mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "//todo": "echo \"add test-all-versions\"", "test-services:start": "cd ../.. && npm run test-services:start memcached", "test-services:stop": "cd ../.. && npm run test-services:stop memcached", diff --git a/packages/instrumentation-mongodb/package.json b/packages/instrumentation-mongodb/package.json index c2b21474bd..4942b6d969 100644 --- a/packages/instrumentation-mongodb/package.json +++ b/packages/instrumentation-mongodb/package.json @@ -26,7 +26,7 @@ "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test", "test-all-versions": "tav", "test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "test-services:start": "cd ../.. && npm run test-services:start mongodb", "test-services:stop": "cd ../.. && npm run test-services:stop mongodb", "watch": "tsc -w" diff --git a/packages/instrumentation-mysql/package.json b/packages/instrumentation-mysql/package.json index c5f1977217..da13891d8a 100644 --- a/packages/instrumentation-mysql/package.json +++ b/packages/instrumentation-mysql/package.json @@ -19,7 +19,7 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc --no-clean mocha 'test/**/*.test.ts'", "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "//todo": "echo \"add test-all-versions\"", "test-services:start": "cd ../.. && npm run test-services:start mysql", "test-services:stop": "cd ../.. && npm run test-services:stop mysql", diff --git a/packages/instrumentation-mysql2/package.json b/packages/instrumentation-mysql2/package.json index 37ef3882ae..54a65c65a6 100644 --- a/packages/instrumentation-mysql2/package.json +++ b/packages/instrumentation-mysql2/package.json @@ -21,7 +21,7 @@ "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test", "test-all-versions": "tav", "test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "test-services:start": "cd ../.. && npm run test-services:start mysql", "test-services:stop": "cd ../.. && npm run test-services:stop mysql", "version:update": "node ../../scripts/version-update.js" diff --git a/packages/instrumentation-nestjs-core/package.json b/packages/instrumentation-nestjs-core/package.json index 7148cd0a29..3fa7216168 100644 --- a/packages/instrumentation-nestjs-core/package.json +++ b/packages/instrumentation-nestjs-core/package.json @@ -11,8 +11,8 @@ }, "scripts": { "clean": "rimraf build/*", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-nestjs-core", "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-nestjs-core", "compile:watch": "tsc -w", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", @@ -21,7 +21,7 @@ "test": "npm run test-required-node-version && nyc --no-clean mocha --timeout 5000 'test/**/*.test.ts' || echo 'Node version is not supported for testing'", "test-required-node-version": "node -e \"process.exit(parseInt(process.versions.node.split('.')[0], 10) >= 15 ? 0 : 1)\"", "test-all-versions": "tav", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js" }, "keywords": [ diff --git a/packages/instrumentation-net/package.json b/packages/instrumentation-net/package.json index e7ae907c7b..e13db7a628 100644 --- a/packages/instrumentation-net/package.json +++ b/packages/instrumentation-net/package.json @@ -20,7 +20,7 @@ "version:update": "node ../../scripts/version-update.js", "compile": "tsc -p .", "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-net", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json" }, "keywords": [ "connect", diff --git a/packages/instrumentation-oracledb/package.json b/packages/instrumentation-oracledb/package.json index edb3c4c267..4da27704ec 100644 --- a/packages/instrumentation-oracledb/package.json +++ b/packages/instrumentation-oracledb/package.json @@ -11,8 +11,8 @@ }, "scripts": { "clean": "rimraf build/*", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-oracledb", "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-oracledb", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", @@ -24,7 +24,7 @@ "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test", "test-all-versions": "tav", "test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "test-services:start": "cd ../.. && npm run test-services:start oracledb", "test-services:stop": "cd ../.. && npm run test-services:stop oracledb", "version:update": "node ../../scripts/version-update.js", diff --git a/packages/instrumentation-pino/package.json b/packages/instrumentation-pino/package.json index 339628ec62..62f7cac0cd 100644 --- a/packages/instrumentation-pino/package.json +++ b/packages/instrumentation-pino/package.json @@ -10,18 +10,18 @@ "directory": "packages/instrumentation-pino" }, "scripts": { - "test": "nyc --no-clean mocha 'test/**/*.test.ts'", - "test-all-versions": "tav", - "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-pino", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "version:update": "node ../../scripts/version-update.js", - "compile": "tsc -p .", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-pino", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "tdd": "npm run test -- --watch-extensions ts --watch", + "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "test-all-versions": "tav", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", + "version:update": "node ../../scripts/version-update.js" }, "keywords": [ "instrumentation", diff --git a/packages/instrumentation-restify/package.json b/packages/instrumentation-restify/package.json index d179bf2276..eeb963a487 100644 --- a/packages/instrumentation-restify/package.json +++ b/packages/instrumentation-restify/package.json @@ -11,16 +11,16 @@ }, "scripts": { "clean": "rimraf build/*", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-restify", "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-restify", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "tdd": "yarn test -- --watch-extensions ts --watch", + "tdd": "npm test -- --watch-extensions ts --watch", "test": "nyc --no-clean mocha 'test/**/*.ts'", "test-all-versions": "tav", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" }, diff --git a/packages/instrumentation-router/package.json b/packages/instrumentation-router/package.json index bb71e03174..f8e5d92862 100644 --- a/packages/instrumentation-router/package.json +++ b/packages/instrumentation-router/package.json @@ -10,18 +10,18 @@ "directory": "packages/instrumentation-router" }, "scripts": { - "test": "nyc --no-clean mocha 'test/**/*.ts'", - "tdd": "yarn test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-router", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", - "version:update": "node ../../scripts/version-update.js", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-router", - "compile": "tsc -p .", "prepublishOnly": "npm run compile", - "watch": "tsc -w", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "tdd": "npm test -- --watch-extensions ts --watch", + "test": "nyc --no-clean mocha 'test/**/*.ts'", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", + "version:update": "node ../../scripts/version-update.js", + "watch": "tsc -w" }, "keywords": [ "instrumentation", diff --git a/packages/instrumentation-runtime-node/package.json b/packages/instrumentation-runtime-node/package.json index 13b25b2b01..05e3964a42 100644 --- a/packages/instrumentation-runtime-node/package.json +++ b/packages/instrumentation-runtime-node/package.json @@ -12,13 +12,13 @@ "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-runtime-node#readme", "scripts": { "clean": "rimraf build/*", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-runtime-node", "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-runtime-node", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "prepublishOnly": "npm run compile", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", "test": "nyc --no-clean mocha 'test/**/*.test.ts'", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js" }, "author": "OpenTelemetry Authors", diff --git a/packages/instrumentation-socket.io/package.json b/packages/instrumentation-socket.io/package.json index ce24c90f38..8f97e6db9f 100644 --- a/packages/instrumentation-socket.io/package.json +++ b/packages/instrumentation-socket.io/package.json @@ -10,18 +10,18 @@ "directory": "packages/instrumentation-socket.io" }, "scripts": { - "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", - "test-all-versions": "tav", - "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-socket.io", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "lint:readme": "node ../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", - "version:update": "node ../../scripts/version-update.js", - "compile": "tsc -p .", - "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-socket.io", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json" + "tdd": "npm run test -- --watch-extensions ts --watch", + "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test-all-versions": "tav", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", + "version:update": "node ../../scripts/version-update.js" }, "keywords": [ "socket.io", diff --git a/packages/instrumentation-tedious/package.json b/packages/instrumentation-tedious/package.json index 9fdbf0439c..f74e1f18e1 100644 --- a/packages/instrumentation-tedious/package.json +++ b/packages/instrumentation-tedious/package.json @@ -21,7 +21,7 @@ "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test", "test-all-versions": "tav", "test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "test-services:start": "cd ../.. && npm run test-services:start mssql", "test-services:stop": "cd ../.. && npm run test-services:stop mssql", "version:update": "node ../../scripts/version-update.js" diff --git a/packages/instrumentation-typeorm/package.json b/packages/instrumentation-typeorm/package.json index 21a6b928de..0d1facb32f 100644 --- a/packages/instrumentation-typeorm/package.json +++ b/packages/instrumentation-typeorm/package.json @@ -20,9 +20,9 @@ "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", - "test-all-versions": "tav", "test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-all-versions": "tav", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" }, diff --git a/packages/instrumentation-undici/package.json b/packages/instrumentation-undici/package.json index 61618699d0..152ff6fc16 100644 --- a/packages/instrumentation-undici/package.json +++ b/packages/instrumentation-undici/package.json @@ -15,11 +15,11 @@ "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-undici", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", + "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc --no-clean mocha test/**/*.test.ts", "test-all-versions": "tav", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", - "prepublishOnly": "npm run compile", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" }, diff --git a/packages/instrumentation-winston/package.json b/packages/instrumentation-winston/package.json index ab41700095..f4f651094c 100644 --- a/packages/instrumentation-winston/package.json +++ b/packages/instrumentation-winston/package.json @@ -19,7 +19,7 @@ "prepublishOnly": "npm run compile", "test": "nyc mocha 'test/**/*.test.ts'", "test-all-versions": "tav", - "coverage:merge": "nyc merge .nyc_output coverage/coverage-final.json", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js" }, "keywords": [ From 1ed709777dd2c8d2b7f02976efaa05ae02c384f3 Mon Sep 17 00:00:00 2001 From: David Luna Date: Fri, 1 Aug 2025 17:04:16 +0200 Subject: [PATCH 25/74] chore: add missign peer dependenciy for tav tests in pino --- packages/instrumentation-pino/.tav.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/instrumentation-pino/.tav.yml b/packages/instrumentation-pino/.tav.yml index 737cc73989..c3abaf041e 100644 --- a/packages/instrumentation-pino/.tav.yml +++ b/packages/instrumentation-pino/.tav.yml @@ -5,7 +5,14 @@ pino: node: ">=18" commands: npm run test - versions: - include: '>=5.14.0 <9' + include: '>=7.0.0 <9' mode: max-7 node: ">=14" commands: npm run test + - versions: + include: '>=5.14.0 <7' + mode: max-7 + node: ">=14" + peerDependencies: + - "fast-safe-stringify@2.1.1" + commands: npm run test From 0896c535492af0df74706ae3242b4934392af1af Mon Sep 17 00:00:00 2001 From: David Luna Date: Fri, 1 Aug 2025 18:28:49 +0200 Subject: [PATCH 26/74] chore: add tav command to debug --- packages/instrumentation-pino/.tav.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/instrumentation-pino/.tav.yml b/packages/instrumentation-pino/.tav.yml index c3abaf041e..a2ff2d05fe 100644 --- a/packages/instrumentation-pino/.tav.yml +++ b/packages/instrumentation-pino/.tav.yml @@ -15,4 +15,6 @@ pino: node: ">=14" peerDependencies: - "fast-safe-stringify@2.1.1" - commands: npm run test + commands: + - npm ls -la + - npm run test From 996e92c8d8f19fcded7753bf89bfe453a7a0bfd9 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 21 Aug 2025 11:13:51 +0200 Subject: [PATCH 27/74] chore: reduce the noise on debug command --- packages/instrumentation-pino/.tav.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/instrumentation-pino/.tav.yml b/packages/instrumentation-pino/.tav.yml index a2ff2d05fe..4fc90a983f 100644 --- a/packages/instrumentation-pino/.tav.yml +++ b/packages/instrumentation-pino/.tav.yml @@ -16,5 +16,5 @@ pino: peerDependencies: - "fast-safe-stringify@2.1.1" commands: - - npm ls -la + - npm ls fast-safe-stringify - npm run test From 2694774feb07fdc447025e5c8a5ba0aa4e20e31d Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 21 Aug 2025 13:07:06 +0200 Subject: [PATCH 28/74] chore: run TAV sequentially to check pino issue --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 15c671b003..0d078401cc 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "test:browser": "nx run-many -t test:browser", "test:browser:ci:affected": "nx affected -t test:browser --base=origin/main --head=HEAD", "test-all-versions": "nx run-many -t test-all-versions", - "test-all-versions:ci:affected": "nx affected -t test-all-versions --base=origin/main --head=HEAD", + "test-all-versions:ci:affected": "nx affected --parallel=1 -t test-all-versions --base=origin/main --head=HEAD", "coverage:merge:ci:affected": "nx affected -t coverage:merge --base=origin/main --head=HEAD", "test-services:start": "docker compose -f ./test/docker-compose.yaml up -d --wait", "test-services:stop": "docker compose -f ./test/docker-compose.yaml down", From bb9f9e695ccfff9f3b608814f0df6a76a9e57637 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 21 Aug 2025 18:26:07 +0200 Subject: [PATCH 29/74] chore: tweak num of precesses running tests --- .github/workflows/pr-test.yml | 2 -- package.json | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index f33f3b6833..78d736a5c1 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -255,7 +255,6 @@ jobs: - name: Install run: npm ci # NOTE: keep this in sync with the node versions from `unit-test` job - # TODO: doownload browser coverage - name: Download Test Artifacts (18) uses: actions/download-artifact@v4 with: @@ -285,7 +284,6 @@ jobs: run: npm run coverage:merge:ci:affected - name: Check coverage run: find . | grep coverage-final - - name: Report Coverage uses: codecov/codecov-action@v5 env: diff --git a/package.json b/package.json index 0d078401cc..d477900353 100644 --- a/package.json +++ b/package.json @@ -20,12 +20,13 @@ "test:ci:affected": "nx affected -t test --base=origin/main --head=HEAD", "test:browser": "nx run-many -t test:browser", "test:browser:ci:affected": "nx affected -t test:browser --base=origin/main --head=HEAD", - "test-all-versions": "nx run-many -t test-all-versions", - "test-all-versions:ci:affected": "nx affected --parallel=1 -t test-all-versions --base=origin/main --head=HEAD", + "test-all-versions": "nx run-many --parallel=2 -t test-all-versions", + "test-all-versions:ci:affected": "nx affected --parallel=2 -t test-all-versions --base=origin/main --head=HEAD", "coverage:merge:ci:affected": "nx affected -t coverage:merge --base=origin/main --head=HEAD", "test-services:start": "docker compose -f ./test/docker-compose.yaml up -d --wait", "test-services:stop": "docker compose -f ./test/docker-compose.yaml down", "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env npm test", + "test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env npm run test-all-versions", "changelog": "lerna-changelog", "lint": "nx run-many -t lint && npm run lint:deps && npm run lint:readme && npm run lint:markdown && npm run lint:semconv-deps && npm run lint:examples", "lint:fix": "nx run-many -t lint:fix && npm run lint:markdown:fix", From 4ec6c5e500c843c4d799f10e579aa0df80ab07e2 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 21 Aug 2025 19:00:39 +0200 Subject: [PATCH 30/74] chore: disable parallelization in TAV --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d477900353..eebf48f417 100644 --- a/package.json +++ b/package.json @@ -20,13 +20,12 @@ "test:ci:affected": "nx affected -t test --base=origin/main --head=HEAD", "test:browser": "nx run-many -t test:browser", "test:browser:ci:affected": "nx affected -t test:browser --base=origin/main --head=HEAD", - "test-all-versions": "nx run-many --parallel=2 -t test-all-versions", - "test-all-versions:ci:affected": "nx affected --parallel=2 -t test-all-versions --base=origin/main --head=HEAD", + "test-all-versions": "nx run-many --parallel=false -t test-all-versions", + "test-all-versions:ci:affected": "nx affected --parallel=false -t test-all-versions --base=origin/main --head=HEAD", "coverage:merge:ci:affected": "nx affected -t coverage:merge --base=origin/main --head=HEAD", "test-services:start": "docker compose -f ./test/docker-compose.yaml up -d --wait", "test-services:stop": "docker compose -f ./test/docker-compose.yaml down", "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env npm test", - "test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env npm run test-all-versions", "changelog": "lerna-changelog", "lint": "nx run-many -t lint && npm run lint:deps && npm run lint:readme && npm run lint:markdown && npm run lint:semconv-deps && npm run lint:examples", "lint:fix": "nx run-many -t lint:fix && npm run lint:markdown:fix", From de0473253b587eb7d9c6adb1b6ddf911684e5926 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 21 Aug 2025 19:02:32 +0200 Subject: [PATCH 31/74] chore: restore tav.yml for pino --- packages/instrumentation-pino/.tav.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/instrumentation-pino/.tav.yml b/packages/instrumentation-pino/.tav.yml index 4fc90a983f..371da79c8f 100644 --- a/packages/instrumentation-pino/.tav.yml +++ b/packages/instrumentation-pino/.tav.yml @@ -5,16 +5,7 @@ pino: node: ">=18" commands: npm run test - versions: - include: '>=7.0.0 <9' + include: '>=5.14.0 <9' mode: max-7 node: ">=14" - commands: npm run test - - versions: - include: '>=5.14.0 <7' - mode: max-7 - node: ">=14" - peerDependencies: - - "fast-safe-stringify@2.1.1" - commands: - - npm ls fast-safe-stringify - - npm run test + commands: npm run test \ No newline at end of file From 7d740b107041abd2a0c55e93e29e9b820628fa8c Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 21 Aug 2025 21:49:17 +0200 Subject: [PATCH 32/74] fix: fx coverage merge script --- .github/workflows/pr-test.yml | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 78d736a5c1..d0cc107627 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -281,7 +281,7 @@ jobs: name: tests-coverage-cache-${{ github.run_number }}-22 path: . - name: Merge coverage (Delta) - run: npm run coverage:merge:ci:affected + run: npm run test-merge-coverage:ci:affected - name: Check coverage run: find . | grep coverage-final - name: Report Coverage diff --git a/package.json b/package.json index eebf48f417..232938db69 100644 --- a/package.json +++ b/package.json @@ -22,10 +22,11 @@ "test:browser:ci:affected": "nx affected -t test:browser --base=origin/main --head=HEAD", "test-all-versions": "nx run-many --parallel=false -t test-all-versions", "test-all-versions:ci:affected": "nx affected --parallel=false -t test-all-versions --base=origin/main --head=HEAD", - "coverage:merge:ci:affected": "nx affected -t coverage:merge --base=origin/main --head=HEAD", + "test-merge-coverage:ci:affected": "nx affected -t test-merge-coverage --base=origin/main --head=HEAD", "test-services:start": "docker compose -f ./test/docker-compose.yaml up -d --wait", "test-services:stop": "docker compose -f ./test/docker-compose.yaml down", "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env npm test", + "test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env npm run test-all-versions", "changelog": "lerna-changelog", "lint": "nx run-many -t lint && npm run lint:deps && npm run lint:readme && npm run lint:markdown && npm run lint:semconv-deps && npm run lint:examples", "lint:fix": "nx run-many -t lint:fix && npm run lint:markdown:fix", From c261518799f475ff66d4415b172dc8d2e81b124d Mon Sep 17 00:00:00 2001 From: David Luna Date: Fri, 22 Aug 2025 18:22:13 +0200 Subject: [PATCH 33/74] chore: add openai instrumentation to codecov --- codecov.yml | 248 +++++++++---------- packages/instrumentation-openai/package.json | 3 +- 2 files changed, 126 insertions(+), 125 deletions(-) diff --git a/codecov.yml b/codecov.yml index e0f5e96dae..be118e08b0 100644 --- a/codecov.yml +++ b/codecov.yml @@ -8,271 +8,271 @@ comment: # We set the flags manually to have better control of it # ref: https://docs.codecov.com/docs/flags#advanced-bespoke-flag-management flags: - winston-transport: + auto-instrumentations-web: paths: - - packages/winston-transport/ + - packages/auto-instrumentations-web/ carryforward: true - contrib-test-utils: + auto-instrumentations-node: paths: - - packages/opentelemetry-test-utils/ + - packages/auto-instrumentations-node/ carryforward: true - sql-common: + auto-configuration-propagators: paths: - - packages/opentelemetry-sql-common/ + - packages/auto-configuration-packages/ carryforward: true - redis-common: + baggage-span-processor: paths: - - packages/opentelemetry-redis-common/ + - packages/baggage-span-processor/ carryforward: true - propagation-utils: + baggage-log-record-processor: paths: - - packages/opentelemetry-propagation-utils/ + - packages/baggage-log-record-processor/ carryforward: true - id-generator-aws-xray: + contrib-test-utils: paths: - - packages/opentelemetry-id-generator-aws-xray/ + - packages/opentelemetry-test-utils/ carryforward: true host-metrics: paths: - packages/opentelemetry-host-metrics/ carryforward: true - baggage-span-processor: - paths: - - packages/baggage-span-processor/ - carryforward: true - baggage-log-record-processor: + id-generator-aws-xray: paths: - - packages/baggage-log-record-processor/ + - packages/opentelemetry-id-generator-aws-xray/ carryforward: true - instrumentation-winston: + instrumentation-amqplib: paths: - - packages/instrumentation-winston/ + - packages/instrumentation-amqplib/ carryforward: true - instrumentation-router: + instrumentation-aws-lambda: paths: - - packages/instrumentation-router/ + - packages/instrumentation-aws-lambda/ carryforward: true - instrumentation-restify: + instrumentation-aws-sdk: paths: - - packages/instrumentation-restify/ + - packages/instrumentation-aws-sdk/ carryforward: true - instrumentation-redis-4: + instrumentation-bunyan: paths: - - packages/instrumentation-redis-4/ + - packages/instrumentation-bunyan/ carryforward: true - instrumentation-redis: + instrumentation-cassandra-driver: paths: - - packages/instrumentation-redis/ + - packages/instrumentation-cassandra-driver/ carryforward: true - instrumentation-pino: + instrumentation-connect: paths: - - packages/instrumentation-pino/ + - packages/instrumentation-connect/ carryforward: true - instrumentation-pg: + instrumentation-cucumber: paths: - - packages/instrumentation-pg/ + - packages/instrumentation-cucumber/ carryforward: true - instrumentation-oracledb: + instrumentation-dataloader: paths: - - packages/instrumentation-oracledb/ + - packages/instrumentation-dataloader/ carryforward: true - instrumentation-net: + instrumentation-dns: paths: - - packages/instrumentation-net/ + - packages/instrumentation-dns/ carryforward: true - instrumentation-nestjs-core: + instrumentation-document-load: paths: - - packages/instrumentation-nestjs-core/ + - packages/instrumentation-document-load/ carryforward: true - instrumentation-mysql2: + instrumentation-express: paths: - - packages/instrumentation-mysql2/ + - packages/instrumentation-express/ carryforward: true - instrumentation-mysql: + instrumentation-fastify: paths: - - packages/instrumentation-mysql/ + - packages/instrumentation-fastify/ carryforward: true - instrumentation-mongodb: + instrumentation-fs: paths: - - packages/instrumentation-mongodb/ + - packages/instrumentation-fs/ carryforward: true - instrumentation-memcached: + instrumentation-generic-pool: paths: - - packages/instrumentation-memcached/ + - packages/instrumentation-generic-pool/ carryforward: true - instrumentation-koa: + instrumentation-graphql: paths: - - packages/instrumentation-koa/ + - packages/instrumentation-graphql/ carryforward: true - instrumentation-knex: + instrumentation-hapi: paths: - - packages/instrumentation-knex/ + - packages/instrumentation-hapi/ carryforward: true instrumentation-ioredis: paths: - packages/instrumentation-ioredis/ carryforward: true - instrumentation-hapi: + instrumentation-kafkajs: paths: - - packages/instrumentation-hapi/ + - packages/instrumentation-kafkajs/ carryforward: true - instrumentation-graphql: + instrumentation-knex: paths: - - packages/instrumentation-graphql/ + - packages/instrumentation-knex/ carryforward: true - instrumentation-generic-pool: + instrumentation-koa: paths: - - packages/instrumentation-generic-pool/ + - packages/instrumentation-koa/ carryforward: true - instrumentation-fastify: + instrumentation-long-task: paths: - - packages/instrumentation-fastify/ + - packages/instrumentation-long-task/ carryforward: true - instrumentation-express: + instrumentation-lru-memoizer: paths: - - packages/instrumentation-express/ + - packages/instrumentation-lru-memoizer/ carryforward: true - instrumentation-dns: + instrumentation-memcached: paths: - - packages/instrumentation-dns/ + - packages/instrumentation-memcached/ carryforward: true - instrumentation-connect: + instrumentation-mongodb: paths: - - packages/instrumentation-connect/ + - packages/instrumentation-mongodb/ carryforward: true - instrumentation-cassandra-driver: + instrumentation-mongoose: paths: - - packages/instrumentation-cassandra/ + - packages/instrumentation-mongoose/ carryforward: true - instrumentation-bunyan: + instrumentation-mysql: paths: - - packages/instrumentation-bunyan/ + - packages/instrumentation-mysql/ carryforward: true - instrumentation-aws-sdk: + instrumentation-mysql2: paths: - - packages/instrumentation-aws-sdk/ + - packages/instrumentation-mysql2/ carryforward: true - instrumentation-aws-lambda: + instrumentation-nestjs-core: paths: - - packages/instrumentation-aws-lambda/ + - packages/instrumentation-nestjs-core/ carryforward: true - instrumentation-undici: + instrumentation-net: paths: - - packages/instrumentation-undici/ + - packages/instrumentation-net/ carryforward: true - instrumentation-typeorm: + instrumentation-openai: paths: - - packages/instrumentation-typeorm/ + - packages/instrumentation-openai/ carryforward: true - instrumentation-tedious: + instrumentation-oracledb: paths: - - packages/instrumentation-tedious/ + - packages/instrumentation-oracledb/ carryforward: true - instrumentation-socket.io: + instrumentation-pg: paths: - - packages/instrumentation-socket.io/ + - packages/instrumentation-pg/ carryforward: true - instrumentation-runtime-node: + instrumentation-pino: paths: - - packages/instrumentation-runtime-node/ + - packages/instrumentation-pino/ carryforward: true - instrumentation-mongoose: + instrumentation-redis: paths: - - packages/instrumentation-mongoose/ + - packages/instrumentation-redis/ carryforward: true - instrumentation-lru-memoizer: + instrumentation-restify: paths: - - packages/instrumentation-lru-memoizer/ + - packages/instrumentation-restify/ carryforward: true - instrumentation-kafkajs: + instrumentation-router: paths: - - packages/instrumentation-kafkajs/ + - packages/instrumentation-router/ carryforward: true - instrumentation-fs: + instrumentation-runtime-node: paths: - - packages/instrumentation-fs/ + - packages/instrumentation-runtime-node/ carryforward: true - instrumentation-dataloader: + instrumentation-socket.io: paths: - - packages/instrumentation-dataloader/ + - packages/instrumentation-socket.io/ carryforward: true - instrumentation-cucumber: + instrumentation-tedious: paths: - - packages/instrumentation-cucumber/ + - packages/instrumentation-tedious/ carryforward: true - instrumentation-amqplib: + instrumentation-typeorm: paths: - - packages/instrumentation-amqplib/ + - packages/instrumentation-typeorm/ carryforward: true - plugin-react-load: + instrumentation-undici: paths: - - packages/plugin-react-load/ + - packages/instrumentation-undici/ carryforward: true instrumentation-user-interaction: paths: - packages/instrumentation-user-interaction/ carryforward: true - instrumentation-long-task: + instrumentation-winston: paths: - - packages/instrumentation-long-task/ + - packages/instrumentation-winston/ carryforward: true - instrumentation-document-load: + plugin-react-load: paths: - - packages/instrumentation-document-load/ + - packages/plugin-react-load/ carryforward: true - propagator-aws-xray-lambda: + propagation-utils: paths: - - packages/propagator-aws-xray-lambda/ + - packages/opentelemetry-propagation-utils/ carryforward: true propagator-aws-xray: paths: - packages/propagator-aws-xray/ carryforward: true - propagator-ot-trace: + propagator-aws-xray-lambda: paths: - - packages/opentelemetry-propagator-ot-trace/ + - packages/propagator-aws-xray-lambda/ carryforward: true propagator-instana: paths: - packages/opentelemetry-propagator-instana/ carryforward: true - resource-detector-instana: + propagator-ot-trace: paths: - - packages/resource-detector-instana/ + - packages/opentelemetry-propagator-ot-trace/ carryforward: true - resource-detector-github: + redis-common: paths: - - packages/resource-detector-github/ + - packages/opentelemetry-redis-common/ carryforward: true - resource-detector-gcp: + resource-detector-alibaba-cloud: paths: - - packages/resource-detector-gcp/ + - packages/resource-detector-alibaba-cloud/ carryforward: true - resource-detector-container: + resource-detector-aws: paths: - - packages/resource-detector-container/ + - packages/resource-detector-aws/ carryforward: true resource-detector-azure: paths: - packages/resource-detector-azure/ carryforward: true - resource-detector-aws: + resource-detector-container: paths: - - packages/resource-detector-aws/ + - packages/resource-detector-container/ carryforward: true - resource-detector-alibaba-cloud: + resource-detector-gcp: paths: - - packages/resource-detector-alibaba-cloud/ + - packages/resource-detector-gcp/ carryforward: true - auto-instrumentations-web: + resource-detector-github: paths: - - packages/auto-instrumentations-web/ + - packages/resource-detector-github/ carryforward: true - auto-instrumentations-node: + resource-detector-instana: paths: - - packages/auto-instrumentations-node/ + - packages/resource-detector-instana/ carryforward: true - auto-configuration-propagators: + sql-common: paths: - - packages/auto-configuration-packages/ + - packages/opentelemetry-sql-common/ carryforward: true + winston-transport: + paths: + - packages/winston-transport/ + carryforward: true \ No newline at end of file diff --git a/packages/instrumentation-openai/package.json b/packages/instrumentation-openai/package.json index 05a42df71c..72497eb29d 100644 --- a/packages/instrumentation-openai/package.json +++ b/packages/instrumentation-openai/package.json @@ -11,7 +11,7 @@ }, "scripts": { "clean": "rimraf build/*", - "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-openai", + "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-mongodb", "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", @@ -20,6 +20,7 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", + "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" }, From c2a34211ad0b325996b6d7e1fd87ab4ea69fd565 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 10:17:25 +0200 Subject: [PATCH 34/74] chore: made test workflow for PRs and push --- .github/workflows/{pr-test.yml => test.yml} | 100 ++++++++++++-------- package.json | 10 +- 2 files changed, 64 insertions(+), 46 deletions(-) rename .github/workflows/{pr-test.yml => test.yml} (79%) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/test.yml similarity index 79% rename from .github/workflows/pr-test.yml rename to .github/workflows/test.yml index d0cc107627..9c002f1ebe 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,8 @@ -name: Pull Request Tests +name: Test Packages on: + push: + branches: [main] pull_request: - # TODO: remove it branches: [main] permissions: @@ -26,7 +27,14 @@ jobs: node-version: 18 - name: Install run: npm ci - # TODO: check if compiling only the affected modules is correct + # Defaults for base and head commits are okay for PRs but + # for pushed commits to main we should take as base the commit before + # ref: https://nx.dev/ci/features/affected#configure-affected-on-ci + - name: Set base and head commits (Push) + if: ${{ github.event_name == 'push' }} + run: | + export NX_BASE=origin/main~1 + export NX_HEAD=origin/main - name: Compile (Delta) run: npm run compile:ci:affected - name: Upload Build Artifacts @@ -173,6 +181,7 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres NPM_CONFIG_UNSAFE_PERM: true + NODE_OPTIONS: --max-old-space-size=4096 steps: - name: Checkout uses: actions/checkout@v4 @@ -188,9 +197,18 @@ jobs: with: name: compile-cache-${{ github.run_number }} path: .nx + # See comment in the compile job + - name: Set base and head commits (Push) + if: ${{ github.event_name == 'push' }} + run: | + export NX_BASE=origin/main~1 + export NX_HEAD=origin/main - name: Compile (Delta) run: npm run compile:ci:affected - - name: Unit tests (Delta) + - name: Unit tests (Browser - Delta) + if: ${{ matrix.node == '22' }} + run: npm run test:browser:ci:affected + - name: Unit tests (Nodejs - Delta) run: npm run test:ci:affected - name: Test All Versions (Delta) run: npm run test-all-versions:ci:affected @@ -203,43 +221,44 @@ jobs: retention-days: 1 path: | !node_modules - **/.nyc_output/** + packages/*/.nyc_output/** + LICENSE - browser-test: - needs: compile - strategy: - fail-fast: false - matrix: - node: ["22"] - runs-on: ubuntu-latest - env: - NPM_CONFIG_UNSAFE_PERM: true - NODE_OPTIONS: --max-old-space-size=4096 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - - name: Install - run: npm ci - - name: Download Build Artifacts - uses: actions/download-artifact@v4 - with: - name: compile-cache-${{ github.run_number }} - path: .nx - - name: Build - run: npm run compile - - name: Unit tests - run: npm run test:browser - - name: Report Coverage - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - verbose: true + # browser-test: + # needs: compile + # strategy: + # fail-fast: false + # matrix: + # node: ["22"] + # runs-on: ubuntu-latest + # env: + # NPM_CONFIG_UNSAFE_PERM: true + # NODE_OPTIONS: --max-old-space-size=4096 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # - uses: actions/setup-node@v4 + # with: + # node-version: ${{ matrix.node }} + # - name: Install + # run: npm ci + # - name: Download Build Artifacts + # uses: actions/download-artifact@v4 + # with: + # name: compile-cache-${{ github.run_number }} + # path: .nx + # - name: Build + # run: npm run compile + # - name: Unit tests (Delta) + # run: npm run test:browser:ci:affected + # - name: Report Coverage + # uses: codecov/codecov-action@v5 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # verbose: true test-coverage-report: runs-on: ubuntu-latest @@ -290,4 +309,3 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: verbose: true - dry_run: true diff --git a/package.json b/package.json index 232938db69..b90d461893 100644 --- a/package.json +++ b/package.json @@ -15,14 +15,14 @@ "clean": "nx run-many -t clean", "version:update": "nx run-many -t version:update", "compile": "nx run-many -t compile", - "compile:ci:affected": "nx affected -t compile --base=origin/main --head=HEAD", + "compile:ci:affected": "nx affected -t compile", "test": "nx run-many -t test", - "test:ci:affected": "nx affected -t test --base=origin/main --head=HEAD", + "test:ci:affected": "nx affected -t test", "test:browser": "nx run-many -t test:browser", - "test:browser:ci:affected": "nx affected -t test:browser --base=origin/main --head=HEAD", + "test:browser:ci:affected": "nx affected -t test:browser", "test-all-versions": "nx run-many --parallel=false -t test-all-versions", - "test-all-versions:ci:affected": "nx affected --parallel=false -t test-all-versions --base=origin/main --head=HEAD", - "test-merge-coverage:ci:affected": "nx affected -t test-merge-coverage --base=origin/main --head=HEAD", + "test-all-versions:ci:affected": "nx affected --parallel=false -t test-all-versions", + "test-merge-coverage:ci:affected": "nx affected -t test-merge-coverage", "test-services:start": "docker compose -f ./test/docker-compose.yaml up -d --wait", "test-services:stop": "docker compose -f ./test/docker-compose.yaml down", "test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env npm test", From 8d746cc1bf0b215c965a64b1cc2d373d4fbefbf9 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 10:25:02 +0200 Subject: [PATCH 35/74] chore: add --no-clean flag for openai tests --- packages/instrumentation-openai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/instrumentation-openai/package.json b/packages/instrumentation-openai/package.json index 72497eb29d..03c764f469 100644 --- a/packages/instrumentation-openai/package.json +++ b/packages/instrumentation-openai/package.json @@ -18,7 +18,7 @@ "lint:readme": "node ../../scripts/lint-readme.js", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json", "version:update": "node ../../scripts/version-update.js", From 70ecb44de85b5b36f211648f4f6f98f849b03190 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 10:39:44 +0200 Subject: [PATCH 36/74] chore: fix commit selection in workflow --- .github/workflows/test.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c002f1ebe..53dfd7d7c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,14 +27,19 @@ jobs: node-version: 18 - name: Install run: npm ci - # Defaults for base and head commits are okay for PRs but - # for pushed commits to main we should take as base the commit before + # Set the right values for base and head commits depending + # on the type of event (PR or push) # ref: https://nx.dev/ci/features/affected#configure-affected-on-ci - - name: Set base and head commits (Push) + - name: Set base and head commits if: ${{ github.event_name == 'push' }} run: | - export NX_BASE=origin/main~1 - export NX_HEAD=origin/main + if [ "${{github.event_name}}" == "push" ] then + export NX_BASE=origin/main~1 + export NX_HEAD=origin/main + else + export NX_BASE=origin/main + export NX_HEAD=HEAD + fi - name: Compile (Delta) run: npm run compile:ci:affected - name: Upload Build Artifacts @@ -198,11 +203,16 @@ jobs: name: compile-cache-${{ github.run_number }} path: .nx # See comment in the compile job - - name: Set base and head commits (Push) + - name: Set base and head commits if: ${{ github.event_name == 'push' }} run: | - export NX_BASE=origin/main~1 - export NX_HEAD=origin/main + if [ "${{github.event_name}}" == "push" ] then + export NX_BASE=origin/main~1 + export NX_HEAD=origin/main + else + export NX_BASE=origin/main + export NX_HEAD=HEAD + fi - name: Compile (Delta) run: npm run compile:ci:affected - name: Unit tests (Browser - Delta) From e71e729c4a59668cabb5a41ec84123a55b1e4e66 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 10:45:45 +0200 Subject: [PATCH 37/74] chore: remove condition in workflow setps --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 53dfd7d7c9..7e63f9aba7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,6 @@ jobs: # on the type of event (PR or push) # ref: https://nx.dev/ci/features/affected#configure-affected-on-ci - name: Set base and head commits - if: ${{ github.event_name == 'push' }} run: | if [ "${{github.event_name}}" == "push" ] then export NX_BASE=origin/main~1 @@ -204,7 +203,6 @@ jobs: path: .nx # See comment in the compile job - name: Set base and head commits - if: ${{ github.event_name == 'push' }} run: | if [ "${{github.event_name}}" == "push" ] then export NX_BASE=origin/main~1 From bf990f10188289a433ed90cc3a84b84c770fb8f9 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 10:50:57 +0200 Subject: [PATCH 38/74] fix: fix syntax --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e63f9aba7..5312d4bc28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: # ref: https://nx.dev/ci/features/affected#configure-affected-on-ci - name: Set base and head commits run: | - if [ "${{github.event_name}}" == "push" ] then + if [ "${{github.event_name}}" == "push" ]; then export NX_BASE=origin/main~1 export NX_HEAD=origin/main else @@ -204,7 +204,7 @@ jobs: # See comment in the compile job - name: Set base and head commits run: | - if [ "${{github.event_name}}" == "push" ] then + if [ "${{github.event_name}}" == "push" ]; then export NX_BASE=origin/main~1 export NX_HEAD=origin/main else From 024089f7574e30eaa36c72f79e07e1cb4cb681eb Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 11:00:06 +0200 Subject: [PATCH 39/74] chore: fix set of env vars for workflow --- .github/workflows/test.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5312d4bc28..d1c078ac66 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,11 +33,11 @@ jobs: - name: Set base and head commits run: | if [ "${{github.event_name}}" == "push" ]; then - export NX_BASE=origin/main~1 - export NX_HEAD=origin/main + echo "NX_BASE=origin/main~1" >> "$GITHUB_ENV" + echo "NX_HEAD=origin/main" >> "$GITHUB_ENV" else - export NX_BASE=origin/main - export NX_HEAD=HEAD + echo "NX_BASE=origin/main" >> "$GITHUB_ENV" + echo "NX_HEAD=HEAD" >> "$GITHUB_ENV" fi - name: Compile (Delta) run: npm run compile:ci:affected @@ -205,11 +205,11 @@ jobs: - name: Set base and head commits run: | if [ "${{github.event_name}}" == "push" ]; then - export NX_BASE=origin/main~1 - export NX_HEAD=origin/main + echo "NX_BASE=origin/main~1" >> "$GITHUB_ENV" + echo "NX_HEAD=origin/main" >> "$GITHUB_ENV" else - export NX_BASE=origin/main - export NX_HEAD=HEAD + echo "NX_BASE=origin/main" >> "$GITHUB_ENV" + echo "NX_HEAD=HEAD" >> "$GITHUB_ENV" fi - name: Compile (Delta) run: npm run compile:ci:affected From 99ccc050bbc0a0cd57956310810a375372c51990 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 11:26:34 +0200 Subject: [PATCH 40/74] chore: update cassandra image --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1c078ac66..2941294052 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -138,7 +138,7 @@ jobs: --health-timeout 5s --health-retries 5 cassandra: - image: bitnami/cassandra:3 + image: bitnami/cassandra:3.11.9 ports: - 9042:9042 rabbitmq: From a74c35779b45cc51072dd9990d75455e3c66e728 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 12:56:39 +0200 Subject: [PATCH 41/74] chore: update comments --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2941294052..4964709d74 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,9 @@ jobs: node-version: 18 - name: Install run: npm ci - # Set the right values for base and head commits depending + # Note: when pushing to main we want to test only what changed in + # last commit. Otherwise we want to test all changes from origin/main. + # So we set the right values for base and head commits depending # on the type of event (PR or push) # ref: https://nx.dev/ci/features/affected#configure-affected-on-ci - name: Set base and head commits @@ -201,7 +203,7 @@ jobs: with: name: compile-cache-${{ github.run_number }} path: .nx - # See comment in the compile job + # Note: see comment in the compile job - name: Set base and head commits run: | if [ "${{github.event_name}}" == "push" ]; then From 390c48eef60641df5dfa02ee98173f4b84c04cfb Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 12:57:22 +0200 Subject: [PATCH 42/74] chore: integrated browser tests in unit test jobs --- .github/workflows/test.yml | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4964709d74..3fe690b1cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -234,42 +234,6 @@ jobs: packages/*/.nyc_output/** LICENSE - # browser-test: - # needs: compile - # strategy: - # fail-fast: false - # matrix: - # node: ["22"] - # runs-on: ubuntu-latest - # env: - # NPM_CONFIG_UNSAFE_PERM: true - # NODE_OPTIONS: --max-old-space-size=4096 - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - # - uses: actions/setup-node@v4 - # with: - # node-version: ${{ matrix.node }} - # - name: Install - # run: npm ci - # - name: Download Build Artifacts - # uses: actions/download-artifact@v4 - # with: - # name: compile-cache-${{ github.run_number }} - # path: .nx - # - name: Build - # run: npm run compile - # - name: Unit tests (Delta) - # run: npm run test:browser:ci:affected - # - name: Report Coverage - # uses: codecov/codecov-action@v5 - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # with: - # verbose: true - test-coverage-report: runs-on: ubuntu-latest needs: unit-test From d296e9607ca10b61d7d3c469f1eb1341fea7329e Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 13:06:23 +0200 Subject: [PATCH 43/74] chore: test affected on a browser instrumentation --- packages/instrumentation-user-interaction/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/instrumentation-user-interaction/package.json b/packages/instrumentation-user-interaction/package.json index 60e0a35fdb..b1b32ed11e 100644 --- a/packages/instrumentation-user-interaction/package.json +++ b/packages/instrumentation-user-interaction/package.json @@ -30,7 +30,8 @@ "tracing", "profiling", "metrics", - "stats" + "stats", + "user-interaction" ], "author": "OpenTelemetry Authors", "license": "Apache-2.0", From 821c403578e3ba120b6b9a4e6902612f94810777 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 13:06:57 +0200 Subject: [PATCH 44/74] chore: remove obsolete workflow --- .github/workflows/test-all-versions.push.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/workflows/test-all-versions.push.yml diff --git a/.github/workflows/test-all-versions.push.yml b/.github/workflows/test-all-versions.push.yml deleted file mode 100644 index 06cc6f1c36..0000000000 --- a/.github/workflows/test-all-versions.push.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: TAV for Push -on: - push: - branches: - - "main" - - "release/**" - - "release-please/**" - -permissions: - contents: read - -jobs: - tav: - uses: ./.github/workflows/test-all-versions.yml - with: - npm-workspace-args: "" From e88a361647d1a27fce3678ae0504489aa61a13c1 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 13:32:14 +0200 Subject: [PATCH 45/74] chore: alig cassandra image to docker compose file --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3fe690b1cf..d382d6296d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -140,7 +140,7 @@ jobs: --health-timeout 5s --health-retries 5 cassandra: - image: bitnami/cassandra:3.11.9 + image: cassandra:3 ports: - 9042:9042 rabbitmq: From f937794b21c561f7f60b970bb1ac672b52a9075d Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 13:35:08 +0200 Subject: [PATCH 46/74] chore: revert memcached version change --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d382d6296d..cf66251e64 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,7 +70,7 @@ jobs: runs-on: ubuntu-latest services: memcached: - image: memcached:1.6.38-alpine + image: memcached:1.6.39-alpine ports: - 11211:11211 mongo: From da4b9624318d3619a6d4757be9c2a9bd631b25ef Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 13:40:56 +0200 Subject: [PATCH 47/74] chore: put corre t version of download-artifact action --- .github/workflows/test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf66251e64..f30a114a8b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -199,7 +199,7 @@ jobs: - name: Install run: npm ci - name: Download Build Artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: compile-cache-${{ github.run_number }} path: .nx @@ -249,27 +249,27 @@ jobs: run: npm ci # NOTE: keep this in sync with the node versions from `unit-test` job - name: Download Test Artifacts (18) - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: tests-coverage-cache-${{ github.run_number }}-18 path: . - name: Download Test Artifacts (18.19.0) - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: tests-coverage-cache-${{ github.run_number }}-18.19.0 path: . - name: Download Test Artifacts (20) - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: tests-coverage-cache-${{ github.run_number }}-20 path: . - name: Download Test Artifacts (20.6.0) - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: tests-coverage-cache-${{ github.run_number }}-20.6.0 path: . - name: Download Test Artifacts (22) - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: tests-coverage-cache-${{ github.run_number }}-22 path: . From 92ee9088972b9b06c8f0cefbd0cce3e726bcd022 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 13:43:53 +0200 Subject: [PATCH 48/74] chore: set proper commits in coverage job --- .github/workflows/test.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f30a114a8b..ca38ff91d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -273,10 +273,18 @@ jobs: with: name: tests-coverage-cache-${{ github.run_number }}-22 path: . + # Note: see comment in the compile job + - name: Set base and head commits + run: | + if [ "${{github.event_name}}" == "push" ]; then + echo "NX_BASE=origin/main~1" >> "$GITHUB_ENV" + echo "NX_HEAD=origin/main" >> "$GITHUB_ENV" + else + echo "NX_BASE=origin/main" >> "$GITHUB_ENV" + echo "NX_HEAD=HEAD" >> "$GITHUB_ENV" + fi - name: Merge coverage (Delta) run: npm run test-merge-coverage:ci:affected - - name: Check coverage - run: find . | grep coverage-final - name: Report Coverage uses: codecov/codecov-action@v5 env: From a4987d44f2c5c4b6906c77c94b0ff784b49df551 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 14:15:00 +0200 Subject: [PATCH 49/74] chore: update codecov comment layout and set back coverage tresholds --- codecov.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index be118e08b0..5d52aea5ef 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,8 +3,17 @@ codecov: after_n_builds: 1 require_ci_to_pass: no comment: - layout: 'header, changes, diff, files' + layout: "header, changes, diff, flags, files" behavior: default +coverage: + status: + patch: + default: + target: 80% + project: + default: + target: auto + threshold: 1% # We set the flags manually to have better control of it # ref: https://docs.codecov.com/docs/flags#advanced-bespoke-flag-management flags: From 112b6849a51fd44056693b9ba5744daed0789046 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 17:35:40 +0200 Subject: [PATCH 50/74] chore: update flag upload script --- scripts/codecov-upload-flags.mjs | 80 ++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 1420f559ec..c2b8797727 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -1,26 +1,80 @@ -import path from 'path'; -import { readFileSync } from 'fs'; +import { execSync } from 'child_process'; import { globSync } from 'glob'; +import { chmod, chmodSync, createWriteStream, existsSync, readFileSync } from 'fs'; +import path from 'path'; +import os from 'os'; +import { Readable } from 'stream'; const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); +const download = async (url, dst) => { + const resp = await fetch(url); + return new Promise((res, rej) => { + if (resp.ok && resp.body) { + console.log("Writing to file:", dst); + let writer = createWriteStream(dst); + Readable.fromWeb(resp.body).pipe(writer); + writer.on('finish', res); + writer.on('error', rej); + } else { + rej(new Error('Could not get body from request')); + } + }); +}; const TOP = process.cwd(); +// const TEMP = os.tmpdir(); + const pkgInfo = readPkg(TOP); const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); -const pkgFlags = pkgFiles.flat().map((f) => { +const codecovPath = path.resolve(TOP, 'codecov'); +const pkgsWithFlag = pkgFiles.flat().map((f) => { const path = f.replace('package.json', ''); const info = readPkg(path); const name = info.name; const flag = name.replace('@opentelemetry/', ''); - - return { name, flag, len: flag.length, path }; + const report = path + 'coverage/coverage-final.json'; + const command = `${codecovPath} do-upload -t -f ${report} --disable-search -F ${flag} -d`; + return { name, flag, len: flag.length, path, report, command }; }); -// Print the flags -pkgFlags.forEach((pf) => { - console.log(` - ${pf.flag}: - paths: - - ${pf.path} - carryforward: true`) -}); \ No newline at end of file +// Download codecov +const urlMap = { + linux: 'https://cli.codecov.io/latest/linux/codecov', + darwin: 'https://cli.codecov.io/latest/macos/codecov', +}; +const url = urlMap[process.platform]; +const token = process.argv[2]; +// Validations +if (typeof token !== 'string') { + console.log('Token is missing. Usage:'); + console.log('node ./scripts/codecov-upload-flags.mjs my-codecov-token'); + process.exit(-1); +} +if (!url) { + console.log(`No codecov binary available for platform "${process.platform}"`); + console.log(`Available platforms are "${Object.keys(urlMap)}"`); + process.exit(-1); +} + +// Download CLI tool if needed +if (existsSync(codecovPath)) { + console.log(`Codecov binary found.`); +} else { + console.log(`Codecov binary missing. Downloading from ${url}`); + await download(url, codecovPath); + console.log(`Codecov binary downloaded to ${codecovPath}`); +} +// make sure we have exec perms +chmodSync(codecovPath, 0o555); + +// Compute the commands to run +for (const pkg of pkgsWithFlag) { + if (existsSync(pkg.report)) { + const command = pkg.command.replace('', token) + console.log(`Uploading report of ${pkg.name} with flag ${pkg.flag}`); + console.log(`Command: ${command}`); + execSync(command, {cwd: TOP, encoding: 'utf-8'}); + } else { + console.log(`Report of ${pkg.name} not found. Expected existence of ${pkg.report}`); + } +} From eb5f75b642a38642e1663bcfcfd0fcc1d0779f29 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 28 Aug 2025 18:13:37 +0200 Subject: [PATCH 51/74] chore: update upload flags script --- scripts/codecov-upload-flags.mjs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index c2b8797727..5dc0e499d5 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -22,8 +22,6 @@ const download = async (url, dst) => { }; const TOP = process.cwd(); -// const TEMP = os.tmpdir(); - const pkgInfo = readPkg(TOP); const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); const codecovPath = path.resolve(TOP, 'codecov'); @@ -33,7 +31,7 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { const name = info.name; const flag = name.replace('@opentelemetry/', ''); const report = path + 'coverage/coverage-final.json'; - const command = `${codecovPath} do-upload -t -f ${report} --disable-search -F ${flag} -d`; + const command = `./codecov do-upload -t -f ${report} --disable-search -F ${flag} -d`; return { name, flag, len: flag.length, path, report, command }; }); @@ -72,7 +70,6 @@ for (const pkg of pkgsWithFlag) { if (existsSync(pkg.report)) { const command = pkg.command.replace('', token) console.log(`Uploading report of ${pkg.name} with flag ${pkg.flag}`); - console.log(`Command: ${command}`); execSync(command, {cwd: TOP, encoding: 'utf-8'}); } else { console.log(`Report of ${pkg.name} not found. Expected existence of ${pkg.report}`); From 3ea2b4afe1f7f775547320a3f14b88eeaf279a00 Mon Sep 17 00:00:00 2001 From: David Luna Date: Fri, 29 Aug 2025 16:32:28 +0200 Subject: [PATCH 52/74] chore: switch codecov action to upload script --- .github/workflows/test.yml | 14 ++++--- scripts/codecov-upload-flags.mjs | 68 ++++++++++++++++---------------- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b2eb1f5be6..3c4771fd79 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -285,9 +285,11 @@ jobs: fi - name: Merge coverage (Delta) run: npm run test-merge-coverage:ci:affected - - name: Report Coverage - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - verbose: true + - name: Report Coverage with Flags + run: node ./scripts/codecov-upload-flags.mjs + # - name: Report Coverage + # uses: codecov/codecov-action@v5 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # verbose: true diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 5dc0e499d5..c712d7ed6c 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -1,53 +1,48 @@ import { execSync } from 'child_process'; import { globSync } from 'glob'; -import { chmod, chmodSync, createWriteStream, existsSync, readFileSync } from 'fs'; +import { chmodSync, existsSync, readFileSync } from 'fs'; import path from 'path'; -import os from 'os'; -import { Readable } from 'stream'; +const ROOT_DIR = process.cwd(); const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); -const download = async (url, dst) => { - const resp = await fetch(url); - return new Promise((res, rej) => { - if (resp.ok && resp.body) { - console.log("Writing to file:", dst); - let writer = createWriteStream(dst); - Readable.fromWeb(resp.body).pipe(writer); - writer.on('finish', res); - writer.on('error', rej); - } else { - rej(new Error('Could not get body from request')); - } - }); -}; +const execCmd = (cmd, opts = {}) => execSync(cmd, {cwd: ROOT_DIR, encoding: 'utf-8', stdio: 'inherit', ...opts}) -const TOP = process.cwd(); -const pkgInfo = readPkg(TOP); +const commitSha = execCmd('git rev-parse HEAD', {stdio: 'pipe'}).replace('\n', ''); +const branchName = execCmd('git rev-parse --abbrev-ref HEAD', {stdio: 'pipe'}).replace('\n', ''); +const pkgInfo = readPkg(ROOT_DIR); const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); -const codecovPath = path.resolve(TOP, 'codecov'); +const codecovPath = path.resolve(ROOT_DIR, 'codecov'); const pkgsWithFlag = pkgFiles.flat().map((f) => { const path = f.replace('package.json', ''); const info = readPkg(path); const name = info.name; const flag = name.replace('@opentelemetry/', ''); const report = path + 'coverage/coverage-final.json'; - const command = `./codecov do-upload -t -f ${report} --disable-search -F ${flag} -d`; + // NOTE: command extracted fromt the codecov action. You can see an example in + // https://github.com/open-telemetry/opentelemetry-js-contrib/actions/runs/17320649481/job/49176411722?pr=2866 + // + // Example: + // ./codecov --verbose upload-coverage --git-service github --sha f08e6cceec6f39d61b1a9c35aed2e53b54a55d36 --branch david-luna:dluna-ci-pr-speed-and-coverage --gcov-executable gcov + const command = [ + './codecov --verbose', + 'upload-coverage', + '--git-service github', + '--gcov-executable gcov', + '--sha', commitSha, + '--branch', branchName, + '--dry-run', + ].join(' '); return { name, flag, len: flag.length, path, report, command }; }); // Download codecov +const baseUrl = 'https://cli.codecov.io/latest/'; const urlMap = { - linux: 'https://cli.codecov.io/latest/linux/codecov', - darwin: 'https://cli.codecov.io/latest/macos/codecov', + linux: `${baseUrl}linux/codecov`, + darwin: `${baseUrl}macos/codecov`, }; + const url = urlMap[process.platform]; -const token = process.argv[2]; -// Validations -if (typeof token !== 'string') { - console.log('Token is missing. Usage:'); - console.log('node ./scripts/codecov-upload-flags.mjs my-codecov-token'); - process.exit(-1); -} if (!url) { console.log(`No codecov binary available for platform "${process.platform}"`); console.log(`Available platforms are "${Object.keys(urlMap)}"`); @@ -59,8 +54,12 @@ if (existsSync(codecovPath)) { console.log(`Codecov binary found.`); } else { console.log(`Codecov binary missing. Downloading from ${url}`); - await download(url, codecovPath); - console.log(`Codecov binary downloaded to ${codecovPath}`); + execCmd(`curl -O "${url}"`); + console.log(`Verifying codecov binary downloaded to ${codecovPath}`); + execCmd(`echo "$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)" | gpg --no-default-keyring --import`); + execCmd(`curl -O "${url}.SHA256SUM"`); + execCmd(`curl -O "${url}.SHA256SUM.sig"`); + execCmd(`gpg --verify "${codecovPath}.SHA256SUM.sig" "${codecovPath}.SHA256SUM"`); } // make sure we have exec perms chmodSync(codecovPath, 0o555); @@ -68,9 +67,10 @@ chmodSync(codecovPath, 0o555); // Compute the commands to run for (const pkg of pkgsWithFlag) { if (existsSync(pkg.report)) { - const command = pkg.command.replace('', token) console.log(`Uploading report of ${pkg.name} with flag ${pkg.flag}`); - execSync(command, {cwd: TOP, encoding: 'utf-8'}); + const command = pkg.command.replace('', 'Oxffff').replace('', 'my-branch'); + // execCmd(command, {cwd: TOP, encoding: 'utf-8'}); + console.log(command) } else { console.log(`Report of ${pkg.name} not found. Expected existence of ${pkg.report}`); } From 2598ed94046459c9fef02b7f26a366f8f68ce786 Mon Sep 17 00:00:00 2001 From: David Luna Date: Fri, 29 Aug 2025 20:10:27 +0200 Subject: [PATCH 53/74] chore: pass sha and branch as parameters --- .github/workflows/test.yml | 2 +- scripts/codecov-upload-flags.mjs | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3c4771fd79..cc4f033475 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,7 +286,7 @@ jobs: - name: Merge coverage (Delta) run: npm run test-merge-coverage:ci:affected - name: Report Coverage with Flags - run: node ./scripts/codecov-upload-flags.mjs + run: node ./scripts/codecov-upload-flags.mjs ${{github.ref_name}} ${{github.sha}} # - name: Report Coverage # uses: codecov/codecov-action@v5 # env: diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index c712d7ed6c..be59260ce7 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -3,12 +3,22 @@ import { globSync } from 'glob'; import { chmodSync, existsSync, readFileSync } from 'fs'; import path from 'path'; +const branchName = process.argv[2]; +const commitSha = process.argv[3]; + +if (typeof branchName !== 'string') { + console.log('Branch name missing! Exiting'); + process.exit(-1); +} +if (typeof commitSha !== 'string') { + console.log('Commit sha missing! Exiting'); + process.exit(-1); +} + const ROOT_DIR = process.cwd(); const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); -const execCmd = (cmd, opts = {}) => execSync(cmd, {cwd: ROOT_DIR, encoding: 'utf-8', stdio: 'inherit', ...opts}) +const execCmd = (cmd, opts = {}) => execSync(cmd, {cwd: process.cwd(), encoding: 'utf-8', stdio: 'inherit', ...opts}); -const commitSha = execCmd('git rev-parse HEAD', {stdio: 'pipe'}).replace('\n', ''); -const branchName = execCmd('git rev-parse --abbrev-ref HEAD', {stdio: 'pipe'}).replace('\n', ''); const pkgInfo = readPkg(ROOT_DIR); const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); const codecovPath = path.resolve(ROOT_DIR, 'codecov'); From b51a54a4d633bf96a3555c81903af2902a52f695 Mon Sep 17 00:00:00 2001 From: David Luna Date: Sat, 30 Aug 2025 01:28:44 +0200 Subject: [PATCH 54/74] chore: update ref name in upload reports --- .github/workflows/test.yml | 2 +- scripts/codecov-upload-flags.mjs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cc4f033475..d695130693 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,7 +286,7 @@ jobs: - name: Merge coverage (Delta) run: npm run test-merge-coverage:ci:affected - name: Report Coverage with Flags - run: node ./scripts/codecov-upload-flags.mjs ${{github.ref_name}} ${{github.sha}} + run: node ./scripts/codecov-upload-flags.mjs ${{github.ref}} ${{github.sha}} # - name: Report Coverage # uses: codecov/codecov-action@v5 # env: diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index be59260ce7..35387f0aef 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -81,7 +81,5 @@ for (const pkg of pkgsWithFlag) { const command = pkg.command.replace('', 'Oxffff').replace('', 'my-branch'); // execCmd(command, {cwd: TOP, encoding: 'utf-8'}); console.log(command) - } else { - console.log(`Report of ${pkg.name} not found. Expected existence of ${pkg.report}`); } } From 7455a31be1a832a4729145ba6ae5845e8a4b22bb Mon Sep 17 00:00:00 2001 From: David Luna Date: Mon, 1 Sep 2025 11:11:26 +0200 Subject: [PATCH 55/74] chore: add debug logs in workflow --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d695130693..6b22a9bd83 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,10 @@ jobs: NPM_CONFIG_UNSAFE_PERM: true NODE_OPTIONS: --max-old-space-size=4096 steps: + - name: Echo label & sha + run: | + echo "${{ github.event.pull_request.head.label }}" + echo "${{ github.event.pull_request.head.sha }}" - name: Checkout uses: actions/checkout@v5 with: @@ -286,7 +290,7 @@ jobs: - name: Merge coverage (Delta) run: npm run test-merge-coverage:ci:affected - name: Report Coverage with Flags - run: node ./scripts/codecov-upload-flags.mjs ${{github.ref}} ${{github.sha}} + run: node ./scripts/codecov-upload-flags.mjs ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }} # - name: Report Coverage # uses: codecov/codecov-action@v5 # env: From ea1d6a868f00aeb235ac7cf511a51e2aa5f22d80 Mon Sep 17 00:00:00 2001 From: David Luna Date: Mon, 1 Sep 2025 11:14:41 +0200 Subject: [PATCH 56/74] chore: enable codecov execution --- .github/workflows/test.yml | 4 ---- scripts/codecov-upload-flags.mjs | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b22a9bd83..e144812e49 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,10 +17,6 @@ jobs: NPM_CONFIG_UNSAFE_PERM: true NODE_OPTIONS: --max-old-space-size=4096 steps: - - name: Echo label & sha - run: | - echo "${{ github.event.pull_request.head.label }}" - echo "${{ github.event.pull_request.head.sha }}" - name: Checkout uses: actions/checkout@v5 with: diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 35387f0aef..25bca63b48 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -77,9 +77,8 @@ chmodSync(codecovPath, 0o555); // Compute the commands to run for (const pkg of pkgsWithFlag) { if (existsSync(pkg.report)) { - console.log(`Uploading report of ${pkg.name} with flag ${pkg.flag}`); + console.log(`CODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n\n`); const command = pkg.command.replace('', 'Oxffff').replace('', 'my-branch'); - // execCmd(command, {cwd: TOP, encoding: 'utf-8'}); - console.log(command) + execCmd(command, {cwd: TOP, encoding: 'utf-8'}); } } From c39e7bcdc2561a5c2c7f9ee97c29615ff26ce7a9 Mon Sep 17 00:00:00 2001 From: David Luna Date: Mon, 1 Sep 2025 12:15:32 +0200 Subject: [PATCH 57/74] chore: use atuomatic flag management --- codecov.yml | 277 +------------------------------ scripts/codecov-upload-flags.mjs | 2 +- 2 files changed, 8 insertions(+), 271 deletions(-) diff --git a/codecov.yml b/codecov.yml index 5d52aea5ef..cd592893d0 100644 --- a/codecov.yml +++ b/codecov.yml @@ -14,274 +14,11 @@ coverage: default: target: auto threshold: 1% -# We set the flags manually to have better control of it -# ref: https://docs.codecov.com/docs/flags#advanced-bespoke-flag-management -flags: - auto-instrumentations-web: - paths: - - packages/auto-instrumentations-web/ - carryforward: true - auto-instrumentations-node: - paths: - - packages/auto-instrumentations-node/ - carryforward: true - auto-configuration-propagators: - paths: - - packages/auto-configuration-packages/ - carryforward: true - baggage-span-processor: - paths: - - packages/baggage-span-processor/ - carryforward: true - baggage-log-record-processor: - paths: - - packages/baggage-log-record-processor/ - carryforward: true - contrib-test-utils: - paths: - - packages/opentelemetry-test-utils/ - carryforward: true - host-metrics: - paths: - - packages/opentelemetry-host-metrics/ - carryforward: true - id-generator-aws-xray: - paths: - - packages/opentelemetry-id-generator-aws-xray/ - carryforward: true - instrumentation-amqplib: - paths: - - packages/instrumentation-amqplib/ - carryforward: true - instrumentation-aws-lambda: - paths: - - packages/instrumentation-aws-lambda/ - carryforward: true - instrumentation-aws-sdk: - paths: - - packages/instrumentation-aws-sdk/ - carryforward: true - instrumentation-bunyan: - paths: - - packages/instrumentation-bunyan/ - carryforward: true - instrumentation-cassandra-driver: - paths: - - packages/instrumentation-cassandra-driver/ - carryforward: true - instrumentation-connect: - paths: - - packages/instrumentation-connect/ - carryforward: true - instrumentation-cucumber: - paths: - - packages/instrumentation-cucumber/ - carryforward: true - instrumentation-dataloader: - paths: - - packages/instrumentation-dataloader/ - carryforward: true - instrumentation-dns: - paths: - - packages/instrumentation-dns/ - carryforward: true - instrumentation-document-load: - paths: - - packages/instrumentation-document-load/ - carryforward: true - instrumentation-express: - paths: - - packages/instrumentation-express/ - carryforward: true - instrumentation-fastify: - paths: - - packages/instrumentation-fastify/ - carryforward: true - instrumentation-fs: - paths: - - packages/instrumentation-fs/ - carryforward: true - instrumentation-generic-pool: - paths: - - packages/instrumentation-generic-pool/ - carryforward: true - instrumentation-graphql: - paths: - - packages/instrumentation-graphql/ - carryforward: true - instrumentation-hapi: - paths: - - packages/instrumentation-hapi/ - carryforward: true - instrumentation-ioredis: - paths: - - packages/instrumentation-ioredis/ - carryforward: true - instrumentation-kafkajs: - paths: - - packages/instrumentation-kafkajs/ - carryforward: true - instrumentation-knex: - paths: - - packages/instrumentation-knex/ - carryforward: true - instrumentation-koa: - paths: - - packages/instrumentation-koa/ - carryforward: true - instrumentation-long-task: - paths: - - packages/instrumentation-long-task/ - carryforward: true - instrumentation-lru-memoizer: - paths: - - packages/instrumentation-lru-memoizer/ - carryforward: true - instrumentation-memcached: - paths: - - packages/instrumentation-memcached/ - carryforward: true - instrumentation-mongodb: - paths: - - packages/instrumentation-mongodb/ - carryforward: true - instrumentation-mongoose: - paths: - - packages/instrumentation-mongoose/ - carryforward: true - instrumentation-mysql: - paths: - - packages/instrumentation-mysql/ - carryforward: true - instrumentation-mysql2: - paths: - - packages/instrumentation-mysql2/ - carryforward: true - instrumentation-nestjs-core: - paths: - - packages/instrumentation-nestjs-core/ - carryforward: true - instrumentation-net: - paths: - - packages/instrumentation-net/ - carryforward: true - instrumentation-openai: - paths: - - packages/instrumentation-openai/ - carryforward: true - instrumentation-oracledb: - paths: - - packages/instrumentation-oracledb/ - carryforward: true - instrumentation-pg: - paths: - - packages/instrumentation-pg/ - carryforward: true - instrumentation-pino: - paths: - - packages/instrumentation-pino/ - carryforward: true - instrumentation-redis: - paths: - - packages/instrumentation-redis/ - carryforward: true - instrumentation-restify: - paths: - - packages/instrumentation-restify/ - carryforward: true - instrumentation-router: - paths: - - packages/instrumentation-router/ - carryforward: true - instrumentation-runtime-node: - paths: - - packages/instrumentation-runtime-node/ - carryforward: true - instrumentation-socket.io: - paths: - - packages/instrumentation-socket.io/ - carryforward: true - instrumentation-tedious: - paths: - - packages/instrumentation-tedious/ - carryforward: true - instrumentation-typeorm: - paths: - - packages/instrumentation-typeorm/ - carryforward: true - instrumentation-undici: - paths: - - packages/instrumentation-undici/ - carryforward: true - instrumentation-user-interaction: - paths: - - packages/instrumentation-user-interaction/ - carryforward: true - instrumentation-winston: - paths: - - packages/instrumentation-winston/ - carryforward: true - plugin-react-load: - paths: - - packages/plugin-react-load/ - carryforward: true - propagation-utils: - paths: - - packages/opentelemetry-propagation-utils/ - carryforward: true - propagator-aws-xray: - paths: - - packages/propagator-aws-xray/ - carryforward: true - propagator-aws-xray-lambda: - paths: - - packages/propagator-aws-xray-lambda/ - carryforward: true - propagator-instana: - paths: - - packages/opentelemetry-propagator-instana/ - carryforward: true - propagator-ot-trace: - paths: - - packages/opentelemetry-propagator-ot-trace/ - carryforward: true - redis-common: - paths: - - packages/opentelemetry-redis-common/ - carryforward: true - resource-detector-alibaba-cloud: - paths: - - packages/resource-detector-alibaba-cloud/ - carryforward: true - resource-detector-aws: - paths: - - packages/resource-detector-aws/ - carryforward: true - resource-detector-azure: - paths: - - packages/resource-detector-azure/ - carryforward: true - resource-detector-container: - paths: - - packages/resource-detector-container/ - carryforward: true - resource-detector-gcp: - paths: - - packages/resource-detector-gcp/ - carryforward: true - resource-detector-github: - paths: - - packages/resource-detector-github/ - carryforward: true - resource-detector-instana: - paths: - - packages/resource-detector-instana/ - carryforward: true - sql-common: - paths: - - packages/opentelemetry-sql-common/ - carryforward: true - winston-transport: - paths: - - packages/winston-transport/ +# Codecov action does not read this file to do the split of coverage +# by flag. So there is no reaso to have explicit flag definition. +# We use automatinc flag management. +# ref: https://about.codecov.io/blog/introducing-improved-flag-management-with-automatic-flags/ +# note: Uploads are made per package(flag) in ./scripts/codecov-upload-flags.mjs +flag_management: + default_rules: carryforward: true \ No newline at end of file diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 25bca63b48..84f4aa646f 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -79,6 +79,6 @@ for (const pkg of pkgsWithFlag) { if (existsSync(pkg.report)) { console.log(`CODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n\n`); const command = pkg.command.replace('', 'Oxffff').replace('', 'my-branch'); - execCmd(command, {cwd: TOP, encoding: 'utf-8'}); + execCmd(command); } } From a9e7074cfa5092615eabaf9aa1c436c40e5a5677 Mon Sep 17 00:00:00 2001 From: David Luna Date: Mon, 1 Sep 2025 17:34:50 +0200 Subject: [PATCH 58/74] chore: add report and flag to codecov command --- scripts/codecov-upload-flags.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 84f4aa646f..0ab40c3358 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -37,9 +37,12 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { './codecov --verbose', 'upload-coverage', '--git-service github', + '--plugin gcov', // we don't need xcrun or pycoverage '--gcov-executable gcov', '--sha', commitSha, '--branch', branchName, + '--file', report, + '--flag', flag, '--dry-run', ].join(' '); return { name, flag, len: flag.length, path, report, command }; @@ -77,8 +80,8 @@ chmodSync(codecovPath, 0o555); // Compute the commands to run for (const pkg of pkgsWithFlag) { if (existsSync(pkg.report)) { - console.log(`CODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n\n`); - const command = pkg.command.replace('', 'Oxffff').replace('', 'my-branch'); + const command = pkg.command; + console.log(`CODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n${command}\n\n`); execCmd(command); } } From a29b19b01d7d0eeec97acff0214b5be1c7115769 Mon Sep 17 00:00:00 2001 From: David Luna Date: Mon, 1 Sep 2025 18:52:05 +0200 Subject: [PATCH 59/74] chore: add dir to codecov command --- scripts/codecov-upload-flags.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 0ab40c3358..558f1c4c1d 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -41,6 +41,7 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { '--gcov-executable gcov', '--sha', commitSha, '--branch', branchName, + '--dir', path, '--file', report, '--flag', flag, '--dry-run', From 957a5c9123a8b988aceff513fb5f5c3d019f0f16 Mon Sep 17 00:00:00 2001 From: David Luna Date: Mon, 1 Sep 2025 20:09:07 +0200 Subject: [PATCH 60/74] chore: update path for network file search --- scripts/codecov-upload-flags.mjs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 558f1c4c1d..695e62639a 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -28,22 +28,25 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { const name = info.name; const flag = name.replace('@opentelemetry/', ''); const report = path + 'coverage/coverage-final.json'; - // NOTE: command extracted fromt the codecov action. You can see an example in - // https://github.com/open-telemetry/opentelemetry-js-contrib/actions/runs/17320649481/job/49176411722?pr=2866 - // - // Example: - // ./codecov --verbose upload-coverage --git-service github --sha f08e6cceec6f39d61b1a9c35aed2e53b54a55d36 --branch david-luna:dluna-ci-pr-speed-and-coverage --gcov-executable gcov + // To get a list of available options run + // ``` + // ./codecov --verbose upload-coverage --help + // ``` + // or check https://docs.codecov.com/docs/cli-options const command = [ './codecov --verbose', 'upload-coverage', '--git-service github', - '--plugin gcov', // we don't need xcrun or pycoverage + // we don't need xcrun or pycoverage + '--plugin gcov', '--gcov-executable gcov', '--sha', commitSha, '--branch', branchName, - '--dir', path, '--file', report, '--flag', flag, + // limit any scan to the pacakge folder + '--network-root-folder', path, + '--dir', path, '--dry-run', ].join(' '); return { name, flag, len: flag.length, path, report, command }; From adf3f00c3756735a79f2ec3e466405d274927afd Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 2 Sep 2025 00:22:36 +0200 Subject: [PATCH 61/74] chore: add formatting --- scripts/codecov-upload-flags.mjs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 695e62639a..1c1f244a56 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -37,7 +37,7 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { './codecov --verbose', 'upload-coverage', '--git-service github', - // we don't need xcrun or pycoverage + // we don't need xcrun or pycoverage plugins '--plugin gcov', '--gcov-executable gcov', '--sha', commitSha, @@ -52,7 +52,7 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { return { name, flag, len: flag.length, path, report, command }; }); -// Download codecov +// Download codecov-cli if necessary const baseUrl = 'https://cli.codecov.io/latest/'; const urlMap = { linux: `${baseUrl}linux/codecov`, @@ -66,7 +66,6 @@ if (!url) { process.exit(-1); } -// Download CLI tool if needed if (existsSync(codecovPath)) { console.log(`Codecov binary found.`); } else { @@ -85,7 +84,7 @@ chmodSync(codecovPath, 0o555); for (const pkg of pkgsWithFlag) { if (existsSync(pkg.report)) { const command = pkg.command; - console.log(`CODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n${command}\n\n`); + console.log(`\n\nCODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n${command}`); execCmd(command); } } From 89458a6c74c3c50e4b0c4b6503aa014d1329cea7 Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 2 Sep 2025 12:07:14 +0200 Subject: [PATCH 62/74] chore: add codecov token into script --- .github/workflows/test.yml | 9 +++------ scripts/codecov-upload-flags.mjs | 15 +++++++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e144812e49..24ab38cccc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -287,9 +287,6 @@ jobs: run: npm run test-merge-coverage:ci:affected - name: Report Coverage with Flags run: node ./scripts/codecov-upload-flags.mjs ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }} - # - name: Report Coverage - # uses: codecov/codecov-action@v5 - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # with: - # verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 1c1f244a56..f9f1e28520 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -5,6 +5,7 @@ import path from 'path'; const branchName = process.argv[2]; const commitSha = process.argv[3]; +const codecovToken = process.env.CODECOV_TOKEN; if (typeof branchName !== 'string') { console.log('Branch name missing! Exiting'); @@ -14,10 +15,14 @@ if (typeof commitSha !== 'string') { console.log('Commit sha missing! Exiting'); process.exit(-1); } +if (typeof codecovToken !== 'string') { + console.log('CODECOV_TOKEN env var missing! Exiting'); + process.exit(-1); +} const ROOT_DIR = process.cwd(); const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); -const execCmd = (cmd, opts = {}) => execSync(cmd, {cwd: process.cwd(), encoding: 'utf-8', stdio: 'inherit', ...opts}); +const execCmd = (cmd, opts = {}) => execSync(cmd, {encoding: 'utf-8', stdio: 'inherit', ...opts}); const pkgInfo = readPkg(ROOT_DIR); const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); @@ -36,6 +41,7 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { const command = [ './codecov --verbose', 'upload-coverage', + '--token ', '--git-service github', // we don't need xcrun or pycoverage plugins '--plugin gcov', @@ -83,8 +89,9 @@ chmodSync(codecovPath, 0o555); // Compute the commands to run for (const pkg of pkgsWithFlag) { if (existsSync(pkg.report)) { - const command = pkg.command; - console.log(`\n\nCODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n${command}`); - execCmd(command); + const commandForLog = pkg.command; + const commandForShell = pkg.command.replace('', codecovToken); + console.log(`\n\nCODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n${commandForLog}`); + execCmd(commandForShell); } } From 28d0b4ec2ba5ea583ad63b63cb10bbcbb5007753 Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 2 Sep 2025 13:06:23 +0200 Subject: [PATCH 63/74] chore: codecov token is empty --- .github/workflows/test.yml | 2 -- scripts/codecov-upload-flags.mjs | 12 ++---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24ab38cccc..0476b66b01 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -287,6 +287,4 @@ jobs: run: npm run test-merge-coverage:ci:affected - name: Report Coverage with Flags run: node ./scripts/codecov-upload-flags.mjs ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }} - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index f9f1e28520..e7b21bab79 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -5,7 +5,6 @@ import path from 'path'; const branchName = process.argv[2]; const commitSha = process.argv[3]; -const codecovToken = process.env.CODECOV_TOKEN; if (typeof branchName !== 'string') { console.log('Branch name missing! Exiting'); @@ -15,10 +14,6 @@ if (typeof commitSha !== 'string') { console.log('Commit sha missing! Exiting'); process.exit(-1); } -if (typeof codecovToken !== 'string') { - console.log('CODECOV_TOKEN env var missing! Exiting'); - process.exit(-1); -} const ROOT_DIR = process.cwd(); const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); @@ -41,7 +36,6 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { const command = [ './codecov --verbose', 'upload-coverage', - '--token ', '--git-service github', // we don't need xcrun or pycoverage plugins '--plugin gcov', @@ -89,9 +83,7 @@ chmodSync(codecovPath, 0o555); // Compute the commands to run for (const pkg of pkgsWithFlag) { if (existsSync(pkg.report)) { - const commandForLog = pkg.command; - const commandForShell = pkg.command.replace('', codecovToken); - console.log(`\n\nCODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n${commandForLog}`); - execCmd(commandForShell); + console.log(`\n\nCODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n${pkg.command}`); + execCmd(pkg.command); } } From 1fd29b8405eba7ef1c738181266b57bee93e91c2 Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 2 Sep 2025 15:32:58 +0200 Subject: [PATCH 64/74] chore: fix CodeQL issue --- .github/workflows/test.yml | 2 +- scripts/codecov-upload-flags.mjs | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0476b66b01..ba266b8405 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,5 +286,5 @@ jobs: - name: Merge coverage (Delta) run: npm run test-merge-coverage:ci:affected - name: Report Coverage with Flags - run: node ./scripts/codecov-upload-flags.mjs ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }} + run: node ./scripts/codecov-upload-flags.mjs ${{github.workspace}} ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }} diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index e7b21bab79..639e3b963a 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -3,9 +3,14 @@ import { globSync } from 'glob'; import { chmodSync, existsSync, readFileSync } from 'fs'; import path from 'path'; -const branchName = process.argv[2]; -const commitSha = process.argv[3]; +const ROOT_DIR = process.argv[2]; +const branchName = process.argv[3]; +const commitSha = process.argv[4]; +if (typeof ROOT_DIR !== 'string') { + console.log('Workspace missing! Exiting'); + process.exit(-1); +} if (typeof branchName !== 'string') { console.log('Branch name missing! Exiting'); process.exit(-1); @@ -15,9 +20,8 @@ if (typeof commitSha !== 'string') { process.exit(-1); } -const ROOT_DIR = process.cwd(); const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); -const execCmd = (cmd, opts = {}) => execSync(cmd, {encoding: 'utf-8', stdio: 'inherit', ...opts}); +const execCmd = (cmd, opts = {}) => execSync(cmd, {cwd: ROOT_DIR, encoding: 'utf-8', stdio: 'inherit', ...opts}); const pkgInfo = readPkg(ROOT_DIR); const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); From 2511656d9a342c2a9d22b62942a1be725fc11788 Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 2 Sep 2025 15:44:59 +0200 Subject: [PATCH 65/74] chore: fix CodeQL issue --- scripts/codecov-upload-flags.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 639e3b963a..844538c68c 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -21,7 +21,7 @@ if (typeof commitSha !== 'string') { } const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); -const execCmd = (cmd, opts = {}) => execSync(cmd, {cwd: ROOT_DIR, encoding: 'utf-8', stdio: 'inherit', ...opts}); +const execCmd = (cmd, opts = {}) => execSync(cmd, {cwd: process.argv[2], encoding: 'utf-8', stdio: 'inherit', ...opts}); const pkgInfo = readPkg(ROOT_DIR); const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); From fff0f8cdd78d72b582ddc388ca91946360a2b44f Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 2 Sep 2025 16:01:01 +0200 Subject: [PATCH 66/74] chore: remove any path resolution from inputs --- .github/workflows/test.yml | 2 +- scripts/codecov-upload-flags.mjs | 28 ++++++++++++---------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ba266b8405..0476b66b01 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,5 +286,5 @@ jobs: - name: Merge coverage (Delta) run: npm run test-merge-coverage:ci:affected - name: Report Coverage with Flags - run: node ./scripts/codecov-upload-flags.mjs ${{github.workspace}} ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }} + run: node ./scripts/codecov-upload-flags.mjs ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }} diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 844538c68c..8746b8c831 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -3,14 +3,12 @@ import { globSync } from 'glob'; import { chmodSync, existsSync, readFileSync } from 'fs'; import path from 'path'; -const ROOT_DIR = process.argv[2]; +// Usage +// node ./scripts/codecov-upload-flags.mjs + const branchName = process.argv[3]; const commitSha = process.argv[4]; -if (typeof ROOT_DIR !== 'string') { - console.log('Workspace missing! Exiting'); - process.exit(-1); -} if (typeof branchName !== 'string') { console.log('Branch name missing! Exiting'); process.exit(-1); @@ -21,11 +19,8 @@ if (typeof commitSha !== 'string') { } const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); -const execCmd = (cmd, opts = {}) => execSync(cmd, {cwd: process.argv[2], encoding: 'utf-8', stdio: 'inherit', ...opts}); - -const pkgInfo = readPkg(ROOT_DIR); +const pkgInfo = readPkg('.'); const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); -const codecovPath = path.resolve(ROOT_DIR, 'codecov'); const pkgsWithFlag = pkgFiles.flat().map((f) => { const path = f.replace('package.json', ''); const info = readPkg(path); @@ -70,16 +65,17 @@ if (!url) { process.exit(-1); } +const execOpts = {encoding: 'utf-8', stdio: 'inherit'}; if (existsSync(codecovPath)) { console.log(`Codecov binary found.`); } else { console.log(`Codecov binary missing. Downloading from ${url}`); - execCmd(`curl -O "${url}"`); - console.log(`Verifying codecov binary downloaded to ${codecovPath}`); - execCmd(`echo "$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)" | gpg --no-default-keyring --import`); - execCmd(`curl -O "${url}.SHA256SUM"`); - execCmd(`curl -O "${url}.SHA256SUM.sig"`); - execCmd(`gpg --verify "${codecovPath}.SHA256SUM.sig" "${codecovPath}.SHA256SUM"`); + execSync(`curl -O "${url}"`, execOpts); + console.log(`Verifying codecov binary downloaded to "./codecov"`); + execSync(`echo "$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)" | gpg --no-default-keyring --import`, execOpts); + execSync(`curl -O "${url}.SHA256SUM"`, execOpts); + execSync(`curl -O "${url}.SHA256SUM.sig"`, execOpts); + execSync(`gpg --verify "codecov.SHA256SUM.sig" "codecov.SHA256SUM"`, execOpts); } // make sure we have exec perms chmodSync(codecovPath, 0o555); @@ -88,6 +84,6 @@ chmodSync(codecovPath, 0o555); for (const pkg of pkgsWithFlag) { if (existsSync(pkg.report)) { console.log(`\n\nCODECOV: Uploading report of "${pkg.name}" with flag "${pkg.flag}"\n${pkg.command}`); - execCmd(pkg.command); + execSync(pkg.command, execOpts); } } From 8fe95692421397d0df89388d085e62d8b6a8dfe5 Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 2 Sep 2025 17:02:56 +0200 Subject: [PATCH 67/74] chore: fix arguments in script --- scripts/codecov-upload-flags.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 8746b8c831..bd6c7bec72 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -6,8 +6,8 @@ import path from 'path'; // Usage // node ./scripts/codecov-upload-flags.mjs -const branchName = process.argv[3]; -const commitSha = process.argv[4]; +const branchName = process.argv[2]; +const commitSha = process.argv[3]; if (typeof branchName !== 'string') { console.log('Branch name missing! Exiting'); From 78575e05a17509e2f60ccb158b151a29fdfaf215 Mon Sep 17 00:00:00 2001 From: David Luna Date: Tue, 2 Sep 2025 19:05:09 +0200 Subject: [PATCH 68/74] chore: fix error in script --- scripts/codecov-upload-flags.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index bd6c7bec72..ccde4b398c 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -52,6 +52,7 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { }); // Download codecov-cli if necessary +const codecovPath = './codecov'; const baseUrl = 'https://cli.codecov.io/latest/'; const urlMap = { linux: `${baseUrl}linux/codecov`, @@ -71,7 +72,7 @@ if (existsSync(codecovPath)) { } else { console.log(`Codecov binary missing. Downloading from ${url}`); execSync(`curl -O "${url}"`, execOpts); - console.log(`Verifying codecov binary downloaded to "./codecov"`); + console.log(`Verifying codecov binary downloaded to "${codecovPath}"`); execSync(`echo "$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)" | gpg --no-default-keyring --import`, execOpts); execSync(`curl -O "${url}.SHA256SUM"`, execOpts); execSync(`curl -O "${url}.SHA256SUM.sig"`, execOpts); From 3a613488e473afe006c0e3f43c6883a947afd012 Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 3 Sep 2025 11:58:43 +0200 Subject: [PATCH 69/74] chore: drop dry-run option to actually upload coverage files --- scripts/codecov-upload-flags.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index ccde4b398c..b75c49f4a4 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -46,7 +46,6 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { // limit any scan to the pacakge folder '--network-root-folder', path, '--dir', path, - '--dry-run', ].join(' '); return { name, flag, len: flag.length, path, report, command }; }); From 37ce8fa91a4f61ffe08670e7c792c215f69f5e2f Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 3 Sep 2025 13:36:40 +0200 Subject: [PATCH 70/74] chore: add path fixing --- codecov.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/codecov.yml b/codecov.yml index cd592893d0..d7e21fbda2 100644 --- a/codecov.yml +++ b/codecov.yml @@ -15,10 +15,13 @@ coverage: target: auto threshold: 1% # Codecov action does not read this file to do the split of coverage -# by flag. So there is no reaso to have explicit flag definition. +# by flag. So there is no reason to have explicit flag definition. # We use automatinc flag management. # ref: https://about.codecov.io/blog/introducing-improved-flag-management-with-automatic-flags/ # note: Uploads are made per package(flag) in ./scripts/codecov-upload-flags.mjs flag_management: default_rules: - carryforward: true \ No newline at end of file + carryforward: true +# Now that we upload a report per package we need path fixing +fixes: + - "/home/runner/work/opentelemetry-js-contrib/::" \ No newline at end of file From 74c71e2ba091f4e95895c65f3b3b3468cd92d543 Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 3 Sep 2025 16:03:29 +0200 Subject: [PATCH 71/74] chore: another attempt to fix paths --- codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index d7e21fbda2..2d324402cc 100644 --- a/codecov.yml +++ b/codecov.yml @@ -24,4 +24,4 @@ flag_management: carryforward: true # Now that we upload a report per package we need path fixing fixes: - - "/home/runner/work/opentelemetry-js-contrib/::" \ No newline at end of file + - "/home/runner/work/opentelemetry-js-contrib/opentelemetry-js-contrib/::" \ No newline at end of file From 06a066b8cb69201ea344d6adca56b29199900d2d Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 3 Sep 2025 18:07:25 +0200 Subject: [PATCH 72/74] chore: remove network folder option --- codecov.yml | 3 --- scripts/codecov-upload-flags.mjs | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/codecov.yml b/codecov.yml index 2d324402cc..98f28acca7 100644 --- a/codecov.yml +++ b/codecov.yml @@ -22,6 +22,3 @@ coverage: flag_management: default_rules: carryforward: true -# Now that we upload a report per package we need path fixing -fixes: - - "/home/runner/work/opentelemetry-js-contrib/opentelemetry-js-contrib/::" \ No newline at end of file diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index b75c49f4a4..70d05daa94 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -44,7 +44,7 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { '--file', report, '--flag', flag, // limit any scan to the pacakge folder - '--network-root-folder', path, + // '--network-root-folder', path, '--dir', path, ].join(' '); return { name, flag, len: flag.length, path, report, command }; From af1f79920b6d9b22e81d2348a5fb6c67d84df6fa Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 3 Sep 2025 19:30:19 +0200 Subject: [PATCH 73/74] chore: change param order to support push event --- .github/workflows/test.yml | 2 +- scripts/codecov-upload-flags.mjs | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0476b66b01..aca3f587c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,5 +286,5 @@ jobs: - name: Merge coverage (Delta) run: npm run test-merge-coverage:ci:affected - name: Report Coverage with Flags - run: node ./scripts/codecov-upload-flags.mjs ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }} + run: node ./scripts/codecov-upload-flags.mjs ${{ github.sha }} ${{ github.event.pull_request.head.label }} diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 70d05daa94..65f68b4ed2 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -6,17 +6,17 @@ import path from 'path'; // Usage // node ./scripts/codecov-upload-flags.mjs -const branchName = process.argv[2]; -const commitSha = process.argv[3]; +const commitSha = process.argv[2]; +const branchName = process.argv[3]; -if (typeof branchName !== 'string') { - console.log('Branch name missing! Exiting'); - process.exit(-1); -} if (typeof commitSha !== 'string') { - console.log('Commit sha missing! Exiting'); + console.log('Error: Commit sha missing. Exiting'); process.exit(-1); } +if (typeof branchName !== 'string') { + console.log('Warn: Branch name missing.'); +} + const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); const pkgInfo = readPkg('.'); @@ -40,14 +40,16 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { '--plugin gcov', '--gcov-executable gcov', '--sha', commitSha, - '--branch', branchName, '--file', report, '--flag', flag, // limit any scan to the pacakge folder - // '--network-root-folder', path, '--dir', path, - ].join(' '); - return { name, flag, len: flag.length, path, report, command }; + ]; + + if (branchName) { + command.push('--branch', branchName); + } + return { name, flag, path, report, command: command.join(' ') }; }); // Download codecov-cli if necessary From faffb4e4456657b9616f90d742f5e38cabd2bc32 Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 3 Sep 2025 20:44:24 +0200 Subject: [PATCH 74/74] chore: sha and branch are null in push event --- .github/workflows/test.yml | 2 +- scripts/codecov-upload-flags.mjs | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aca3f587c6..c53bdcc73b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,5 +286,5 @@ jobs: - name: Merge coverage (Delta) run: npm run test-merge-coverage:ci:affected - name: Report Coverage with Flags - run: node ./scripts/codecov-upload-flags.mjs ${{ github.sha }} ${{ github.event.pull_request.head.label }} + run: node ./scripts/codecov-upload-flags.mjs ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.head.label }} diff --git a/scripts/codecov-upload-flags.mjs b/scripts/codecov-upload-flags.mjs index 65f68b4ed2..d6e5ee5725 100644 --- a/scripts/codecov-upload-flags.mjs +++ b/scripts/codecov-upload-flags.mjs @@ -9,15 +9,6 @@ import path from 'path'; const commitSha = process.argv[2]; const branchName = process.argv[3]; -if (typeof commitSha !== 'string') { - console.log('Error: Commit sha missing. Exiting'); - process.exit(-1); -} -if (typeof branchName !== 'string') { - console.log('Warn: Branch name missing.'); -} - - const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); const pkgInfo = readPkg('.'); const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json'))); @@ -39,16 +30,19 @@ const pkgsWithFlag = pkgFiles.flat().map((f) => { // we don't need xcrun or pycoverage plugins '--plugin gcov', '--gcov-executable gcov', - '--sha', commitSha, '--file', report, '--flag', flag, // limit any scan to the pacakge folder '--dir', path, ]; - if (branchName) { + if (typeof commitSha === 'string') { + command.push('--sha', commitSha); + } + if (typeof branchName === 'string') { command.push('--branch', branchName); } + return { name, flag, path, report, command: command.join(' ') }; });