diff --git a/.github/workflows/outdated-integrations.yml b/.github/workflows/outdated-integrations.yml new file mode 100644 index 00000000000..77242d58214 --- /dev/null +++ b/.github/workflows/outdated-integrations.yml @@ -0,0 +1,15 @@ +name: Outdated Integrations + +on: + schedule: + # This, will run every weekday at 2pm UTC + - cron: '0 14 * * 1,2,3,4,5' + +jobs: + outdated-integrations: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/node/setup + - run: yarn install + - run: yarn outdated-integrations diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index dfc032a6118..30561edcac0 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -13,8 +13,23 @@ concurrency: # TODO: upstream jobs - jobs: + versions: + runs-on: ubuntu-latest + outputs: + matrices: ${{steps.plugins.outputs.matrices}} + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/node/latest + - uses: ./.github/actions/install + - id: plugins + run: | + echo "starting up" + echo node --version + content=$(node ./scripts/create_matrix.js) + echo "matrices=$content" >> $GITHUB_OUTPUT + echo $content + aerospike-node-16: runs-on: ubuntu-latest services: @@ -58,7 +73,7 @@ jobs: range: ['5.2.0 - 5.7.0'] include: - node-version: 20 - range: '>=5.8.0' + range: ['5.12.1'] runs-on: ubuntu-latest services: aerospike: @@ -96,7 +111,11 @@ jobs: uses: ./.github/actions/testagent/logs - uses: codecov/codecov-action@v3 - amqp10: + amqp10: # TODO: move rhea to its own job + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.amqp10}} runs-on: ubuntu-latest services: qpid: @@ -110,11 +129,18 @@ jobs: PLUGINS: amqp10 SERVICES: qpid DD_DATA_STREAMS_ENABLED: true + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test-and-upstream + - run: | + echo $strategy.matrix amqplib: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.amqplib}} runs-on: ubuntu-latest services: rabbitmq: @@ -124,14 +150,20 @@ jobs: env: PLUGINS: amqplib SERVICES: rabbitmq + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test-and-upstream apollo: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.apollo}} runs-on: ubuntu-latest env: PLUGINS: apollo + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test-and-upstream @@ -146,9 +178,10 @@ jobs: - uses: ./.github/actions/plugins/test-and-upstream aws-sdk: + needs: + - versions strategy: - matrix: - node-version: ['18', 'latest'] + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.aws-sdk}} runs-on: ubuntu-latest services: localstack: @@ -184,6 +217,7 @@ jobs: PLUGINS: aws-sdk SERVICES: localstack localstack-legacy DD_DATA_STREAMS_ENABLED: true + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/testagent/start @@ -214,22 +248,36 @@ jobs: - uses: ./.github/actions/plugins/test bluebird: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.bluebird}} runs-on: ubuntu-latest env: PLUGINS: bluebird + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test bunyan: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.bunyan}} runs-on: ubuntu-latest env: PLUGINS: bunyan + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test-and-upstream cassandra: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.cassandra}} runs-on: ubuntu-latest services: cassandra: @@ -239,6 +287,7 @@ jobs: env: PLUGINS: cassandra-driver SERVICES: cassandra + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test @@ -260,13 +309,10 @@ jobs: - uses: codecov/codecov-action@v2 couchbase: + needs: + - versions strategy: - matrix: - node-version: [16] - range: ['^2.6.12', '^3.0.7', '>=4.0.0 <4.2.0'] - include: - - node-version: 18 - range: '>=4.2.0' + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.couchbase}} runs-on: ubuntu-latest services: couchbase: @@ -291,26 +337,41 @@ jobs: - uses: codecov/codecov-action@v3 connect: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.connect}} runs-on: ubuntu-latest env: PLUGINS: connect + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test-and-upstream cucumber: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.cucumber}} runs-on: ubuntu-latest env: PLUGINS: cucumber + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test # TODO: fix performance issues and test more Node versions cypress: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.cypress}} runs-on: ubuntu-latest env: PLUGINS: cypress + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/testagent/start @@ -341,6 +402,10 @@ jobs: - uses: codecov/codecov-action@v3 elasticsearch: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.elasticsearch}} runs-on: ubuntu-latest services: elasticsearch: @@ -352,6 +417,7 @@ jobs: env: PLUGINS: elasticsearch SERVICES: elasticsearch + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/testagent/start @@ -364,17 +430,27 @@ jobs: - uses: codecov/codecov-action@v3 express: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.express}} runs-on: ubuntu-latest env: PLUGINS: express|body-parser|cookie-parser + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test fastify: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.fastify}} runs-on: ubuntu-latest env: PLUGINS: fastify + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test @@ -388,14 +464,22 @@ jobs: - uses: ./.github/actions/plugins/test generic-pool: + needs: + - versions + strategy: + matrix: ${{fromJson(needs.versions.outputs.matrices).matrices.generic-pool}} runs-on: ubuntu-latest env: PLUGINS: generic-pool + PACKAGE_VERSION_RANGE: ${{ matrix.range }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/plugins/test google-cloud-pubsub: + strategy: + matrix: + range: ['4.7.2'] runs-on: ubuntu-latest services: pubsub: @@ -410,6 +494,9 @@ jobs: - uses: ./.github/actions/plugins/test graphql: + strategy: + matrix: + range: ['16.9.0'] runs-on: ubuntu-latest env: PLUGINS: graphql @@ -418,6 +505,9 @@ jobs: - uses: ./.github/actions/plugins/test-and-upstream grpc: + strategy: + matrix: + range: ['1.11.2'] runs-on: ubuntu-latest env: PLUGINS: grpc @@ -426,6 +516,9 @@ jobs: - uses: ./.github/actions/plugins/test hapi: + strategy: + matrix: + range: ['18.1.0'] runs-on: ubuntu-latest env: PLUGINS: hapi @@ -474,6 +567,9 @@ jobs: # TODO: fix performance issues and test more Node versions jest: + strategy: + matrix: + range: ['29.7.0'] runs-on: ubuntu-latest env: PLUGINS: jest @@ -488,6 +584,9 @@ jobs: - uses: codecov/codecov-action@v3 kafkajs: + strategy: + matrix: + range: ['2.2.4'] runs-on: ubuntu-latest services: kafka: @@ -515,6 +614,9 @@ jobs: - uses: ./.github/actions/plugins/test knex: + strategy: + matrix: + range: ['3.1.0'] runs-on: ubuntu-latest env: PLUGINS: knex @@ -523,6 +625,9 @@ jobs: - uses: ./.github/actions/plugins/test koa: + strategy: + matrix: + range: ['2.15.3'] runs-on: ubuntu-latest env: PLUGINS: koa @@ -531,6 +636,9 @@ jobs: - uses: ./.github/actions/plugins/test-and-upstream limitd-client: + strategy: + matrix: + range: ['2.14.1'] runs-on: ubuntu-latest services: limitd: @@ -549,6 +657,9 @@ jobs: - uses: ./.github/actions/plugins/test memcached: + strategy: + matrix: + range: ['2.2.2'] runs-on: ubuntu-latest services: memcached: @@ -563,6 +674,9 @@ jobs: - uses: ./.github/actions/plugins/test microgateway-core: + strategy: + matrix: + range: ['3.3.4'] runs-on: ubuntu-latest env: PLUGINS: microgateway-core @@ -571,6 +685,9 @@ jobs: - uses: ./.github/actions/plugins/test mocha: + strategy: + matrix: + range: ['10.7.3'] runs-on: ubuntu-latest env: PLUGINS: mocha @@ -579,6 +696,9 @@ jobs: - uses: ./.github/actions/plugins/test moleculer: + strategy: + matrix: + range: ['0.14.34'] runs-on: ubuntu-latest env: PLUGINS: moleculer @@ -587,6 +707,9 @@ jobs: - uses: ./.github/actions/plugins/test mongodb: + strategy: + matrix: + range: ['6.9.0'] runs-on: ubuntu-latest services: mongodb: @@ -602,6 +725,9 @@ jobs: - uses: ./.github/actions/plugins/test mongodb-core: + strategy: + matrix: + range: ['3.2.7'] runs-on: ubuntu-latest services: mongodb: @@ -617,6 +743,9 @@ jobs: - uses: ./.github/actions/plugins/test mongoose: + strategy: + matrix: + range: ['8.6.2'] runs-on: ubuntu-latest services: mongodb: @@ -631,6 +760,9 @@ jobs: - uses: ./.github/actions/plugins/test mysql: + strategy: + matrix: + range: ['2.18.1'] runs-on: ubuntu-latest services: mysql: @@ -673,11 +805,11 @@ jobs: version: - 18 - latest - range: ['9.5.0', '11.1.4', '13.2.0', '14.2.6'] + range: ['14.2.5'] runs-on: ubuntu-latest env: PLUGINS: next - PACKAGE_VERSION_RANGE: ${{ matrix.range }} + PACKAGE_VERSION_RANGE: ${{matrix.range}} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/testagent/start @@ -689,6 +821,9 @@ jobs: - uses: codecov/codecov-action@v3 openai: + strategy: + matrix: + range: ['4.61.1'] runs-on: ubuntu-latest env: PLUGINS: openai @@ -697,6 +832,9 @@ jobs: - uses: ./.github/actions/plugins/test opensearch: + strategy: + matrix: + range: ['2.12.0'] runs-on: ubuntu-latest services: opensearch: @@ -716,6 +854,9 @@ jobs: # TODO: Install the Oracle client on the host and test Node >=16. # TODO: Figure out why nyc stopped working with EACCESS errors. oracledb: + strategy: + matrix: + range: ['6.6.0'] runs-on: ubuntu-latest container: bengl/node-12-with-oracle-client services: @@ -754,6 +895,9 @@ jobs: - uses: codecov/codecov-action@v2 paperplane: + strategy: + matrix: + range: ['3.1.2'] runs-on: ubuntu-latest env: PLUGINS: paperplane @@ -770,6 +914,9 @@ jobs: # TODO: re-enable upstream tests if it ever stops being flaky pino: + strategy: + matrix: + range: ['9.4.0'] runs-on: ubuntu-latest env: PLUGINS: pino @@ -788,6 +935,9 @@ jobs: - uses: codecov/codecov-action@v3 postgres: + strategy: + matrix: + range: ['8.13.0'] runs-on: ubuntu-latest services: postgres: @@ -805,6 +955,9 @@ jobs: - uses: ./.github/actions/plugins/test promise: + strategy: + matrix: + range: ['8.3.0'] runs-on: ubuntu-latest env: PLUGINS: promise @@ -813,6 +966,9 @@ jobs: - uses: ./.github/actions/plugins/test-and-upstream promise-js: + strategy: + matrix: + range: ['0.0.7'] runs-on: ubuntu-latest env: PLUGINS: promise-js @@ -830,6 +986,9 @@ jobs: - uses: ./.github/actions/plugins/test-and-upstream q: + strategy: + matrix: + range: ['1.5.1'] runs-on: ubuntu-latest env: PLUGINS: q @@ -838,6 +997,9 @@ jobs: - uses: ./.github/actions/plugins/test redis: + strategy: + matrix: + range: ['4.7.0'] runs-on: ubuntu-latest services: redis: @@ -852,6 +1014,9 @@ jobs: - uses: ./.github/actions/plugins/test restify: + strategy: + matrix: + range: ['11.1.0'] runs-on: ubuntu-latest env: PLUGINS: restify @@ -878,6 +1043,9 @@ jobs: - uses: ./.github/actions/plugins/test-and-upstream router: + strategy: + matrix: + range: ['1.3.8'] runs-on: ubuntu-latest env: PLUGINS: router @@ -886,6 +1054,9 @@ jobs: - uses: ./.github/actions/plugins/test sharedb: + strategy: + matrix: + range: ['5.0.4'] runs-on: ubuntu-latest env: PLUGINS: sharedb @@ -901,6 +1072,9 @@ jobs: - uses: codecov/codecov-action@v3 tedious: + strategy: + matrix: + range: ['18.6.1'] runs-on: ubuntu-latest services: mssql: @@ -927,6 +1101,9 @@ jobs: - uses: codecov/codecov-action@v3 undici: + strategy: + matrix: + range: ['4.16.0', '5.28.4', '6.19.8'] runs-on: ubuntu-latest env: PLUGINS: undici @@ -935,6 +1112,9 @@ jobs: - uses: ./.github/actions/plugins/test when: + strategy: + matrix: + range: ['3.7.8'] runs-on: ubuntu-latest env: PLUGINS: when @@ -943,9 +1123,12 @@ jobs: - uses: ./.github/actions/plugins/test winston: + strategy: + matrix: + range: ['3.14.2'] runs-on: ubuntu-latest env: PLUGINS: winston steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/plugins/test + - uses: ./.github/actions/plugins/test \ No newline at end of file diff --git a/package.json b/package.json index 481d0d7bb14..b04633f75f6 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "bench:e2e:ci-visibility": "node benchmark/e2e-ci/benchmark-run.js", "type:doc": "cd docs && yarn && yarn build", "type:test": "cd docs && yarn && yarn test", + "outdated-integrations": "node scripts/outdated.js", "lint": "node scripts/check_licenses.js && eslint . && yarn audit", "lint-fix": "node scripts/check_licenses.js && eslint . --fix && yarn audit", "services": "node ./scripts/install_plugin_modules && node packages/dd-trace/test/setup/services", diff --git a/packages/datadog-instrumentations/src/helpers/latests.json b/packages/datadog-instrumentations/src/helpers/latests.json new file mode 100644 index 00000000000..31f6595bb36 --- /dev/null +++ b/packages/datadog-instrumentations/src/helpers/latests.json @@ -0,0 +1,111 @@ +{ + "pinned": [ + "generic-pool", + "@playwright/test", + "redis" + ], + "latests": { + "aerospike": "5.12.1", + "amqp10": "3.6.0", + "amqplib": "0.10.4", + "apollo-server-core": "3.13.0", + "@apollo/server": "4.11.0", + "@apollo/gateway": "2.9.1", + "@smithy/smithy-client": "3.3.2", + "@aws-sdk/smithy-client": "3.374.0", + "aws-sdk": "2.1691.0", + "bluebird": "3.7.2", + "body-parser": "1.20.3", + "bunyan": "1.8.15", + "cassandra-driver": "4.7.2", + "connect": "3.7.0", + "cookie-parser": "1.4.6", + "cookie": "0.6.0", + "couchbase": "4.4.1", + "@cucumber/cucumber": "11.0.1", + "cypress": "13.14.2", + "@elastic/transport": "8.7.1", + "@elastic/elasticsearch": "8.15.0", + "elasticsearch": "16.7.3", + "express-mongo-sanitize": "2.2.0", + "express": "4.21.0", + "fastify": "5.0.0", + "find-my-way": "9.0.1", + "fs": "0.0.1-security", + "generic-pool": "3.9.0", + "@google-cloud/pubsub": "4.7.2", + "@graphql-tools/executor": "1.3.1", + "graphql": "16.9.0", + "@grpc/grpc-js": "1.11.3", + "@hapi/hapi": "21.3.10", + "hapi": "18.1.0", + "ioredis": "5.4.1", + "jest-environment-node": "29.7.0", + "jest-environment-jsdom": "29.7.0", + "@jest/core": "29.7.0", + "@jest/test-sequencer": "29.7.0", + "@jest/reporters": "29.7.0", + "jest-circus": "29.7.0", + "@jest/transform": "29.7.0", + "jest-config": "29.7.0", + "jest-runtime": "29.7.0", + "jest-worker": "29.7.0", + "kafkajs": "2.2.4", + "knex": "3.1.0", + "koa": "2.15.3", + "@koa/router": "13.1.0", + "koa-router": "13.0.1", + "ldapjs": "3.0.7", + "limitd-client": "2.14.1", + "lodash": "4.17.21", + "mariadb": "3.3.2", + "memcached": "2.2.2", + "microgateway-core": "3.3.4", + "moleculer": "0.14.34", + "mongodb-core": "3.2.7", + "mongodb": "6.9.0", + "mongoose": "8.6.3", + "mquery": "5.0.0", + "mysql": "2.18.1", + "mysql2": "3.11.3", + "next": "14.2.12", + "nyc": "17.0.0", + "openai": "4.62.1", + "@opensearch-project/opensearch": "2.12.0", + "oracledb": "6.6.0", + "paperplane": "3.1.2", + "passport-http": "0.3.0", + "passport-local": "1.0.0", + "pg": "8.13.0", + "pino": "9.4.0", + "pino-pretty": "11.2.2", + "@playwright/test": "1.47.1", + "playwright": "1.47.1", + "promise-js": "0.0.7", + "promise": "8.3.0", + "q": "1.5.1", + "qs": "6.13.0", + "@node-redis/client": "1.0.6", + "@redis/client": "1.6.0", + "redis": "4.7.0", + "restify": "11.1.0", + "rhea": "3.0.2", + "router": "1.3.8", + "selenium-webdriver": "4.24.1", + "sequelize": "6.37.3", + "sharedb": "5.0.4", + "tedious": "18.6.1", + "undici": "6.19.8", + "vitest": "2.1.1", + "@vitest/runner": "2.1.1", + "when": "3.7.8", + "winston": "3.14.2" + }, + "matrices": { + "couchbase": { + "node-version": [16], + "range": [["2.6.12 ", "2.6.12"], ["3.0.7", "3.2.7"], ["4.0.0", "4.4.1"] ], + "include": [{"node-version" : 18}, ["4.4.1", "4.4.1"]] + } + } +} \ No newline at end of file diff --git a/packages/datadog-instrumentations/src/helpers/matrices.json b/packages/datadog-instrumentations/src/helpers/matrices.json new file mode 100644 index 00000000000..098f36e2bc5 --- /dev/null +++ b/packages/datadog-instrumentations/src/helpers/matrices.json @@ -0,0 +1,626 @@ +{ + "matrices": { + "couchbase": { + "node-version": [ + 16 + ], + "range": [ + "2.4.2 - 2.6.12", + "3.0.0 - 3.0.5", + "3.0.7 - 3.2.7", + "4.0.0 - 4.4.2" + ], + "include": [ + { + "node-version": 18, + "range": "4.4.1 - 4.4.2" + } + ] + }, + "aerospike": { + "range": [ + "4.0.0 - 4.0.5", + "5.0.0 - 5.12.1" + ] + }, + "amqp10": { + "range": [ + "3.0.0 - 3.6.0" + ] + }, + "amqplib": { + "range": [ + "0.5.3 - 0.10.4" + ] + }, + "@apollo/gateway": { + "range": [ + "0.1.0 - 0.54.1", + "2.0.0 - 2.9.1" + ] + }, + "@aws-sdk/smithy-client": { + "range": [ + "3.0.0 - 3.374.0" + ] + }, + "aws-sdk": { + "range": [ + "2.1.35 - 2.1691.0" + ] + }, + "bluebird": { + "range": [ + "2.0.0 - 2.11.0", + "3.0.0 - 3.7.2" + ] + }, + "body-parser": { + "range": [ + "1.0.0 - 1.20.3" + ] + }, + "bunyan": { + "range": [ + "1.0.0 - 1.8.15" + ] + }, + "cassandra-driver": { + "range": [ + "3.0.0 - 3.6.0", + "4.0.0 - 4.7.2" + ] + }, + "connect": { + "range": [ + "2.0.0 - 2.30.2", + "3.0.0 - 3.7.0" + ] + }, + "cookie-parser": { + "range": [ + "1.0.0 - 1.4.6" + ] + }, + "cookie": { + "range": [ + "0.0.0 - 0.6.0" + ] + }, + "@cucumber/cucumber": { + "range": [ + "7.0.0 - 7.3.2", + "8.0.0 - 8.11.1", + "9.0.0 - 9.6.0", + "10.0.0 - 10.9.0", + "11.0.0 - 11.0.1" + ] + }, + "cypress": { + "range": [ + "0.0.1 - 0.20.3", + "1.0.0 - 1.4.2", + "2.0.0 - 2.1.0", + "3.0.0 - 3.8.3", + "4.0.0 - 4.12.1", + "5.0.0 - 5.6.0", + "6.0.0 - 6.9.1", + "7.0.0 - 7.7.0", + "8.0.0 - 8.7.0", + "9.0.0 - 9.7.0", + "10.0.0 - 10.11.0", + "11.0.0 - 11.2.0", + "12.0.0 - 12.17.4", + "13.0.0 - 13.14.2" + ] + }, + "@elastic/elasticsearch": { + "range": [ + "5.6.16 - 5.6.22", + "6.7.0 - 6.8.8", + "7.0.0 - 7.17.14", + "8.0.0 - 8.14.1" + ] + }, + "elasticsearch": { + "range": [ + "0.2.0 - 0.3.9", + "1.0.0 - 1.5.14", + "2.0.0 - 2.4.3", + "3.0.0 - 3.1.4", + "4.0.0 - 4.1.0", + "5.0.0 - 5.0.0", + "6.0.0 - 6.1.0", + "8.0.1 - 8.2.0", + "9.0.0 - 9.0.2", + "10.0.0 - 10.1.3", + "11.0.0 - 11.0.1", + "12.0.0 - 12.1.3", + "13.0.0 - 13.3.1", + "14.0.0 - 14.2.2", + "15.0.0 - 15.5.0", + "16.0.0 - 16.7.3" + ] + }, + "express-mongo-sanitize": { + "range": [ + "1.0.0 - 1.3.2", + "2.0.0 - 2.2.0" + ] + }, + "express": { + "range": [ + "4.0.0 - 4.21.0" + ] + }, + "fastify": { + "range": [ + "1.0.0 - 1.14.6", + "2.0.0 - 2.15.3", + "3.0.0 - 3.29.5", + "4.0.0 - 4.28.1", + "5.0.0 - 5.0.0" + ] + }, + "find-my-way": { + "range": [ + "1.0.0 - 1.18.1", + "2.0.0 - 2.2.5", + "3.0.0 - 3.0.5", + "4.0.0 - 4.5.1", + "5.0.0 - 5.6.0", + "6.0.0 - 6.4.0", + "7.0.0 - 7.7.0", + "8.0.0 - 8.2.2", + "9.0.0 - 9.0.1" + ] + }, + "generic-pool": { + "range": [ + "2.0.0 - 2.5.4", + "3.0.0 - 3.9.0" + ] + }, + "@google-cloud/pubsub": { + "range": [ + "1.2.0 - 1.7.3", + "2.0.0 - 2.19.4", + "3.0.0 - 3.7.5", + "4.0.0 - 4.7.2" + ] + }, + "@graphql-tools/executor": { + "range": [ + "0.0.14 - 0.0.20", + "1.0.0 - 1.3.1" + ] + }, + "graphql": { + "range": [ + "0.10.0 - 0.13.2", + "14.0.0 - 14.7.0", + "15.0.0 - 15.9.0", + "16.0.0 - 16.9.0" + ] + }, + "@grpc/grpc-js": { + "range": [ + "1.0.3 - 1.11.3" + ] + }, + "@hapi/hapi": { + "range": [ + "17.9.0 - 17.9.0", + "18.2.0 - 18.4.1", + "19.0.0 - 19.2.0", + "20.0.0 - 20.3.0", + "21.0.0 - 21.3.10" + ] + }, + "hapi": { + "range": [ + "16.0.0 - 16.8.4", + "17.0.0 - 17.8.5", + "18.0.0 - 18.1.0" + ] + }, + "ioredis": { + "range": [ + "2.0.0 - 2.5.0", + "3.0.0 - 3.2.2", + "4.0.0 - 4.28.5", + "5.0.0 - 5.4.1" + ] + }, + "jest-environment-node": { + "range": [ + "24.8.0 - 24.9.0", + "25.0.0 - 25.5.0", + "26.0.0 - 26.6.2", + "27.0.0 - 27.5.1", + "28.0.0 - 28.1.3", + "29.0.0 - 29.7.0" + ] + }, + "kafkajs": { + "range": [ + "1.4.0 - 1.16.0", + "2.0.0 - 2.2.4" + ] + }, + "knex": { + "range": [ + "0.8.0 - 0.95.15", + "1.0.0 - 1.0.7", + "2.0.0 - 2.5.1", + "3.0.0 - 3.1.0" + ] + }, + "koa": { + "range": [ + "2.0.0 - 2.15.3" + ] + }, + "@koa/router": { + "range": [ + "8.0.0 - 8.0.8", + "9.0.1 - 9.4.0", + "10.0.0 - 10.1.1", + "11.0.0 - 11.0.2", + "12.0.0 - 12.0.2", + "13.0.0 - 13.1.0" + ] + }, + "koa-router": { + "range": [ + "7.0.0 - 7.4.0", + "8.0.6 - 8.0.8", + "9.0.1 - 9.4.0", + "10.0.0 - 10.1.1", + "11.0.0 - 11.0.2", + "12.0.0 - 12.0.1", + "13.0.1 - 13.0.1" + ] + }, + "ldapjs": { + "range": [ + "0.1.0 - 0.8.0", + "1.0.0 - 1.0.2", + "2.0.0 - 2.3.3", + "3.0.0 - 3.0.7" + ] + }, + "limitd-client": { + "range": [ + "1.0.0 - 1.13.1", + "2.0.0 - 2.14.1" + ] + }, + "lodash": { + "range": [ + "0.1.0 - 0.10.0", + "1.0.0 - 1.0.2", + "2.0.0 - 2.4.2", + "3.0.0 - 3.10.1", + "4.0.0 - 4.17.21" + ] + }, + "mariadb": { + "range": [ + "3.0.0 - 3.3.2" + ] + }, + "memcached": { + "range": [ + "2.2.0 - 2.2.2" + ] + }, + "microgateway-core": { + "range": [ + "2.1.0 - 2.5.17", + "3.0.0 - 3.3.4" + ] + }, + "moleculer": { + "range": [ + "0.14.0 - 0.14.34" + ] + }, + "mongodb-core": { + "range": [ + "2.0.0 - 2.1.20", + "3.0.0 - 3.2.7" + ] + }, + "mongodb": { + "range": [ + "3.3.0 - 3.7.4", + "4.0.0 - 4.17.2", + "5.0.0 - 5.9.2", + "6.0.0 - 6.9.0" + ] + }, + "mongoose": { + "range": [ + "4.6.4 - 4.13.21", + "5.0.0 - 5.13.22", + "6.0.0 - 6.13.3", + "7.0.0 - 7.8.2", + "8.0.0 - 8.6.3" + ] + }, + "mquery": { + "range": [ + "0.0.1 - 0.9.0", + "1.0.0 - 1.11.0", + "2.0.0 - 2.3.3", + "3.0.0 - 3.2.5", + "4.0.0 - 4.0.3", + "5.0.0 - 5.0.0" + ] + }, + "mysql": { + "range": [ + "2.0.0 - 2.18.1" + ] + }, + "mysql2": { + "range": [ + "1.0.0 - 1.6.6", + "2.0.0 - 2.3.3", + "3.0.0 - 3.11.3" + ] + }, + "next": { + "range": [ + "9.5.0 - 9.5.5", + "10.0.0 - 10.2.3", + "11.0.0 - 11.1.4", + "12.0.0 - 12.3.4", + "13.0.0 - 13.5.7", + "14.0.0 - 14.2.13" + ] + }, + "openai": { + "range": [ + "3.0.0 - 3.3.0", + "4.0.0 - 4.64.0" + ] + }, + "@opensearch-project/opensearch": { + "range": [ + "1.0.0 - 1.2.0", + "2.0.0 - 2.12.0" + ] + }, + "oracledb": { + "range": [ + "5.0.0 - 5.5.0", + "6.0.0 - 6.6.0" + ] + }, + "paperplane": { + "range": [ + "2.3.0 - 2.3.2", + "3.0.0 - 3.1.2" + ] + }, + "passport-http": { + "range": [ + "0.1.0 - 0.3.0" + ] + }, + "passport-local": { + "range": [ + "0.1.0 - 0.1.6", + "1.0.0 - 1.0.0" + ] + }, + "pg": { + "range": [ + "4.0.0 - 4.5.7", + "5.0.0 - 5.2.1", + "6.0.0 - 6.4.2", + "7.0.0 - 7.18.2", + "8.0.0 - 8.13.0" + ] + }, + "pino": { + "range": [ + "2.0.0 - 2.16.0", + "3.0.0 - 3.4.0", + "4.0.0 - 4.17.6", + "5.0.0 - 5.17.0", + "6.0.0 - 6.14.0", + "7.0.0 - 7.11.0", + "8.0.0 - 8.21.0", + "9.0.0 - 9.4.0" + ] + }, + "pino-pretty": { + "range": [ + "1.0.0 - 1.0.1", + "2.0.0 - 2.6.1", + "3.0.0 - 3.6.1", + "4.0.0 - 4.8.0", + "5.0.0 - 5.1.3", + "6.0.0 - 6.0.0", + "7.0.0 - 7.6.1", + "8.0.0 - 8.1.0", + "9.0.0 - 9.4.1", + "10.0.0 - 10.3.1", + "11.0.0 - 11.2.2" + ] + }, + "@playwright/test": { + "range": [ + "0.0.0 - 0.1111.0", + "1.12.0 - 1.47.2" + ] + }, + "playwright": { + "range": [ + "0.0.0 - 0.18.0", + "1.0.0 - 1.47.2" + ] + }, + "promise-js": { + "range": [ + "0.0.3 - 0.0.7" + ] + }, + "promise": { + "range": [ + "7.0.0 - 7.3.1", + "8.0.0 - 8.3.0" + ] + }, + "q": { + "range": [ + "1.0.0 - 1.5.1" + ] + }, + "qs": { + "range": [ + "0.0.0 - 0.6.6", + "1.0.0 - 1.2.2", + "2.0.0 - 2.4.2", + "3.0.0 - 3.1.0", + "4.0.0 - 4.0.0", + "5.0.0 - 5.2.1", + "6.0.0 - 6.13.0" + ] + }, + "@node-redis/client": { + "range": [ + "1.0.0 - 1.0.6" + ] + }, + "@redis/client": { + "range": [ + "1.1.0 - 1.6.0" + ] + }, + "redis": { + "range": [ + "0.12.0 - 0.12.1", + "1.0.0 - 1.0.0", + "2.0.0 - 2.8.0", + "3.0.0 - 3.1.2", + "4.0.0 - 4.7.0" + ] + }, + "restify": { + "range": [ + "3.0.0 - 3.0.3", + "4.0.0 - 4.3.4", + "5.0.0 - 5.2.1", + "6.0.0 - 6.4.0", + "7.0.0 - 7.7.0", + "8.0.0 - 8.6.1", + "9.0.0 - 9.1.0", + "10.0.0 - 10.0.0", + "11.0.0 - 11.1.0" + ] + }, + "rhea": { + "range": [ + "1.0.0 - 1.0.24", + "2.0.0 - 2.0.8", + "3.0.0 - 3.0.3" + ] + }, + "router": { + "range": [ + "0.2.1 - 0.6.2", + "1.0.0 - 1.3.8" + ] + }, + "selenium-webdriver": { + "range": [ + "2.29.0 - 2.53.3", + "3.0.0 - 3.6.0", + "4.0.0 - 4.25.0" + ] + }, + "sequelize": { + "range": [ + "0.0.0 - 0.4.3", + "1.0.0 - 1.7.11", + "2.0.0 - 2.1.3", + "3.0.0 - 3.35.1", + "4.0.0 - 4.44.4", + "5.1.0 - 5.22.5", + "6.1.0 - 6.37.3" + ] + }, + "sharedb": { + "range": [ + "1.0.0 - 1.9.2", + "2.0.0 - 2.2.6", + "3.0.0 - 3.3.2", + "4.0.0 - 4.1.5", + "5.0.0 - 5.0.4" + ] + }, + "tedious": { + "range": [ + "1.0.0 - 1.15.0", + "2.0.0 - 2.7.1", + "3.0.0 - 3.0.1", + "4.0.0 - 4.2.0", + "5.0.0 - 5.0.3", + "6.0.0 - 6.7.1", + "7.0.0 - 7.0.0", + "8.0.0 - 8.3.1", + "9.0.0 - 9.2.3", + "10.0.0 - 10.0.0", + "11.0.0 - 11.8.0", + "12.0.0 - 12.3.0", + "13.0.0 - 13.2.0", + "14.0.0 - 14.7.0", + "15.0.0 - 15.1.3", + "16.0.0 - 16.7.1", + "17.0.0 - 17.0.0", + "18.0.0 - 18.6.2" + ] + }, + "undici": { + "range": [ + "0.1.0 - 0.5.0", + "1.0.0 - 1.3.1", + "2.0.0 - 2.2.1", + "3.0.0 - 3.3.6", + "4.0.0 - 4.16.0", + "5.0.0 - 5.28.4", + "6.0.0 - 6.19.8" + ] + }, + "vitest": { + "range": [ + "0.0.0 - 0.34.6", + "1.0.0 - 1.6.0", + "2.0.0 - 2.1.1" + ] + }, + "@vitest/runner": { + "range": [ + "0.28.0 - 0.34.7", + "1.0.0 - 1.6.0", + "2.0.0 - 2.1.1" + ] + }, + "when": { + "range": [ + "3.0.0 - 3.7.8" + ] + }, + "winston": { + "range": [ + "1.0.0 - 1.1.2", + "2.0.0 - 2.4.7", + "3.0.0 - 3.14.2" + ] + } + } +} \ No newline at end of file diff --git a/packages/datadog-instrumentations/src/helpers/register.js b/packages/datadog-instrumentations/src/helpers/register.js index 4b4185423c0..b67b6f84f54 100644 --- a/packages/datadog-instrumentations/src/helpers/register.js +++ b/packages/datadog-instrumentations/src/helpers/register.js @@ -16,6 +16,7 @@ const { const hooks = require('./hooks') const instrumentations = require('./instrumentations') +const latests = require('./latests.json') const names = Object.keys(hooks) const pathSepExpr = new RegExp(`\\${path.sep}`, 'g') const disabledInstrumentations = new Set( @@ -111,7 +112,7 @@ for (const packageName of names) { namesAndSuccesses[`${name}@${version}`] = false } - if (matchVersion(version, versions)) { + if (matchVersion(version, versions) && matchesLatestSupported(name, version)) { // Check if the hook already has a set moduleExport if (hook[HOOK_SYMBOL].has(moduleExports)) { namesAndSuccesses[`${name}@${version}`] = true @@ -155,6 +156,17 @@ for (const packageName of names) { }) } +function matchesLatestSupported (name, version) { + if (latests.pinned.includes(name)) { + // These ones are deliberately pinned to a specific version. That + // means we can skip this check, since it will already have been checked + // to be lower than latest. + return true + } + const latest = latests.latests[name] + return matchVersion(version, ['<=' + latest]) +} + function matchVersion (version, ranges) { return !version || (ranges && ranges.some(range => semver.satisfies(semver.coerce(version), range))) } diff --git a/packages/datadog-instrumentations/src/helpers/versions.json b/packages/datadog-instrumentations/src/helpers/versions.json new file mode 100644 index 00000000000..ba0c2c13cd5 --- /dev/null +++ b/packages/datadog-instrumentations/src/helpers/versions.json @@ -0,0 +1,756 @@ +{ + "matrices": { + "couchbase": { + "plugin-name": "couchbase", + "min-version": "2.4.2", + "by-node-version": true, + "node-versions": { + "16": [ + "2.4.2 - 2.6.12", + "3.0.0 - 3.2.7", + "3.0.7 - 3.2.7", + "4.0.0 - 4.4.2" + ], + "18": [ + "4.4.1 - 4.4.2" + ], + "strict": [ + + ] + } + }, + "aerospike": { + "plugin-name": "aerospike", + "min-version": "4.0.0", + "by-node-version": true, + "node-versions": { + "16": [ + "4.0.0 - 4.0.5" + + ], + "18": [ + "5.2.0 - 5.7.0" + ], + "20": [ + "5.12.1" + ]} + }, + "amqp10": { + "plugin-name": "amqp10", + "range": [ + "3.0.0 - 3.6.0" + ] + }, + "amqplib": { + "plugin-name": "amqplib", + "min-version": "0.5.0", + "range": [ + "0.5.3 - 0.10.4" + ] + }, + "@apollo/gateway": { + "plugin-name": "apollo", + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.54.1", + "2.0.0 - 2.9.1" + ] + }, + "@aws-sdk/smithy-client": { + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.374.0" + ] + }, + "aws-sdk": { + "plugin-name": "aws-sdk", + "min-version": "2.1.35", + "range": [ + "2.1.35 - 2.1691.0" + ] + }, + "bluebird": { + "plugin-name": "bluebird", + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.11.0", + "3.0.0 - 3.7.2" + ] + }, + "body-parser": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.20.3" + ] + }, + "bunyan": { + "plugin-name": "bunyan", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.8.15" + ] + }, + "cassandra-driver": { + "plugin-name": "cassandra", + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.6.0", + "4.0.0 - 4.7.2" + ] + }, + "connect": { + "plugin-name": "connect", + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.30.2", + "3.0.0 - 3.7.0" + ] + }, + "cookie-parser": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.4.6" + ] + }, + "cookie": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.6.0" + ] + }, + "@cucumber/cucumber": { + "plugin-name": "cucumber", + "min-version": "7.0.0", + "range": [ + "7.0.0 - 7.3.2", + "8.0.0 - 8.11.1", + "9.0.0 - 9.6.0", + "10.0.0 - 10.9.0", + "11.0.0 - 11.0.1" + ] + }, + "cypress": { + "plugin-name": "cypress", + "min-version": "0.0.1", + "range": [ + "0.0.1 - 0.20.3", + "1.0.0 - 1.4.2", + "2.0.0 - 2.1.0", + "3.0.0 - 3.8.3", + "4.0.0 - 4.12.1", + "5.0.0 - 5.6.0", + "6.0.0 - 6.9.1", + "7.0.0 - 7.7.0", + "8.0.0 - 8.7.0", + "9.0.0 - 9.7.0", + "10.0.0 - 10.11.0", + "11.0.0 - 11.2.0", + "12.0.0 - 12.17.4", + "13.0.0 - 13.14.2" + ] + }, + "@elastic/elasticsearch": { + "min-version": "5.6.16", + "range": [ + "5.6.16 - 5.6.22", + "6.7.0 - 6.8.8", + "7.0.0 - 7.17.14", + "8.0.0 - 8.14.1" + ] + }, + "elasticsearch": { + "plugin-name": "elasticsearch", + "min-version": "10.0.0", + "range": [ + "10.0.0 - 10.1.3", + "11.0.0 - 11.0.1", + "12.0.0 - 12.1.3", + "13.0.0 - 13.3.1", + "14.0.0 - 14.2.2", + "15.0.0 - 15.5.0", + "16.0.0 - 16.7.3" + ] + }, + "express-mongo-sanitize": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.3.2", + "2.0.0 - 2.2.0" + ] + }, + "express": { + "plugin-name": "express", + "min-version": "4.0.0", + "range": [ + "4.0.0 - 4.21.0" + ] + }, + "fastify": { + "plugin-name": "fastify", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.14.6", + "2.0.0 - 2.15.3", + "3.0.0 - 3.29.5", + "4.0.0 - 4.28.1", + "5.0.0 - 5.0.0" + ] + }, + "find-my-way": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.18.1", + "2.0.0 - 2.2.5", + "3.0.0 - 3.0.5", + "4.0.0 - 4.5.1", + "5.0.0 - 5.6.0", + "6.0.0 - 6.4.0", + "7.0.0 - 7.7.0", + "8.0.0 - 8.2.2", + "9.0.0 - 9.0.1" + ] + }, + "generic-pool": { + "plugin-name": "generic-pool", + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.5.4", + "3.0.0 - 3.9.0" + ] + }, + "@google-cloud/pubsub": { + "plugin-name": "google-cloud-pubsub", + "min-version": "1.2.0", + "range": [ + "1.2.0 - 1.7.3", + "2.0.0 - 2.19.4", + "3.0.0 - 3.7.5", + "4.0.0 - 4.7.2" + ] + }, + "@graphql-tools/executor": { + "min-version": "0.0.14", + "range": [ + "0.0.14 - 0.0.20", + "1.0.0 - 1.3.1" + ] + }, + "graphql": { + "plugin-name": "graphql", + "min-version": "0.10.0", + "range": [ + "0.10.0 - 0.13.2", + "14.0.0 - 14.7.0", + "15.0.0 - 15.9.0", + "16.0.0 - 16.9.0" + ] + }, + "@grpc/grpc-js": { + "plugin-name": "grpc", + "min-version": "1.0.3", + "range": [ + "1.0.3 - 1.11.3" + ] + }, + "@hapi/hapi": { + "plugin-name": "hapi", + "min-version": "17.9.0", + "range": [ + "17.9.0 - 17.9.0", + "18.2.0 - 18.4.1", + "19.0.0 - 19.2.0", + "20.0.0 - 20.3.0", + "21.0.0 - 21.3.10" + ] + }, + "hapi": { + "plugin-name": "hapi", + "min-version": "16.0.0", + "range": [ + "16.0.0 - 16.8.4", + "17.0.0 - 17.8.5", + "18.0.0 - 18.1.0" + ] + }, + "ioredis": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.5.0", + "3.0.0 - 3.2.2", + "4.0.0 - 4.28.5", + "5.0.0 - 5.4.1" + ] + }, + "jest-environment-node": { + "plugin-name": "jest", + "min-version": "24.8.0", + "range": [ + "24.8.0 - 24.9.0", + "25.0.0 - 25.5.0", + "26.0.0 - 26.6.2", + "27.0.0 - 27.5.1", + "28.0.0 - 28.1.3", + "29.0.0 - 29.7.0" + ] + }, + "kafkajs": { + "plugin-name": "kafkajs", + "min-version": "1.4.0", + "range": [ + "1.4.0 - 1.16.0", + "2.0.0 - 2.2.4" + ] + }, + "knex": { + "plugin-name": "knex", + "min-version": "0.8.0", + "range": [ + "0.8.0 - 0.95.15", + "1.0.0 - 1.0.7", + "2.0.0 - 2.5.1", + "3.0.0 - 3.1.0" + ] + }, + "koa": { + "plugin-name": "koa", + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.15.3" + ] + }, + "@koa/router": { + "min-version": "8.0.0", + "range": [ + "8.0.0 - 8.0.8", + "9.0.1 - 9.4.0", + "10.0.0 - 10.1.1", + "11.0.0 - 11.0.2", + "12.0.0 - 12.0.2", + "13.0.0 - 13.1.0" + ] + }, + "koa-router": { + "min-version": "7.0.0", + "range": [ + "7.0.0 - 7.4.0", + "8.0.6 - 8.0.8", + "9.0.1 - 9.4.0", + "10.0.0 - 10.1.1", + "11.0.0 - 11.0.2", + "12.0.0 - 12.0.1", + "13.0.1 - 13.0.1" + ] + }, + "ldapjs": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.8.0", + "1.0.0 - 1.0.2", + "2.0.0 - 2.3.3", + "3.0.0 - 3.0.7" + ] + }, + "limitd-client": { + "plugin-name": "limitd-client", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.13.1", + "2.0.0 - 2.14.1" + ] + }, + "lodash": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.10.0", + "1.0.0 - 1.0.2", + "2.0.0 - 2.4.2", + "3.0.0 - 3.10.1", + "4.0.0 - 4.17.21" + ] + }, + "mariadb": { + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.3.2" + ] + }, + "memcached": { + "plugin-name": "memcached", + "min-version": "2.2.0", + "range": [ + "2.2.0 - 2.2.2" + ] + }, + "microgateway-core": { + "plugin-name": "microgateway-core", + "min-version": "2.1.0", + "range": [ + "2.1.0 - 2.5.17", + "3.0.0 - 3.3.4" + ] + }, + "moleculer": { + "plugin-name": "moleculer", + "min-version": "0.14.0", + "range": [ + "0.14.0 - 0.14.34" + ] + }, + "mongodb-core": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.1.20", + "3.0.0 - 3.2.7" + ] + }, + "mongodb": { + "plugin-name": "mongodb", + "min-version": "3.3.0", + "range": [ + "3.3.0 - 3.7.4", + "4.0.0 - 4.17.2", + "5.0.0 - 5.9.2", + "6.0.0 - 6.9.0" + ] + }, + "mongoose": { + "plugin-name": "mongoose", + "min-version": "4.6.4", + "range": [ + "4.6.4 - 4.13.21", + "5.0.0 - 5.13.22", + "6.0.0 - 6.13.3", + "7.0.0 - 7.8.2", + "8.0.0 - 8.6.3" + ] + }, + "mquery": { + "min-version": "0.0.1", + "range": [ + "0.0.1 - 0.9.0", + "1.0.0 - 1.11.0", + "2.0.0 - 2.3.3", + "3.0.0 - 3.2.5", + "4.0.0 - 4.0.3", + "5.0.0 - 5.0.0" + ] + }, + "mysql": { + "plugin-name": "msql", + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.18.1" + ] + }, + "mysql2": { + "plugin-name": "mysql2", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.6.6", + "2.0.0 - 2.3.3", + "3.0.0 - 3.11.3" + ] + }, + "next": { + "plugin-name": "next", + "min-version": "9.5.0", + "range": [ + "9.5.0 - 9.5.5", + "10.0.0 - 10.2.3", + "11.0.0 - 11.1.4", + "12.0.0 - 12.3.4", + "13.0.0 - 13.5.7", + "14.0.0 - 14.2.13" + ] + }, + "openai": { + "plugin-name": "openai", + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.3.0", + "4.0.0 - 4.64.0" + ] + }, + "@opensearch-project/opensearch": { + "plugin-name": "opensearch", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.2.0", + "2.0.0 - 2.12.0" + ] + }, + "oracledb": { + "plugin-name": "oracledb", + "min-version": "5.0.0", + "range": [ + "5.0.0 - 5.5.0", + "6.0.0 - 6.6.0" + ] + }, + "paperplane": { + "plugin-name": "paperplane", + "min-version": "2.3.0", + "range": [ + "2.3.0 - 2.3.2", + "3.0.0 - 3.1.2" + ] + }, + "passport-http": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.3.0" + ] + }, + "passport-local": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.1.6", + "1.0.0 - 1.0.0" + ] + }, + "pg": { + "plugin-name": "postgres", + "min-version": "4.0.0", + "range": [ + "4.0.0 - 4.5.7", + "5.0.0 - 5.2.1", + "6.0.0 - 6.4.2", + "7.0.0 - 7.18.2", + "8.0.0 - 8.13.0" + ] + }, + "pino": { + "plugin-name": "pino", + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.16.0", + "3.0.0 - 3.4.0", + "4.0.0 - 4.17.6", + "5.0.0 - 5.17.0", + "6.0.0 - 6.14.0", + "7.0.0 - 7.11.0", + "8.0.0 - 8.21.0", + "9.0.0 - 9.4.0" + ] + }, + "pino-pretty": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.0.1", + "2.0.0 - 2.6.1", + "3.0.0 - 3.6.1", + "4.0.0 - 4.8.0", + "5.0.0 - 5.1.3", + "6.0.0 - 6.0.0", + "7.0.0 - 7.6.1", + "8.0.0 - 8.1.0", + "9.0.0 - 9.4.1", + "10.0.0 - 10.3.1", + "11.0.0 - 11.2.2" + ] + }, + "@playwright/test": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.1111.0", + "1.12.0 - 1.47.2" + ] + }, + "playwright": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.18.0", + "1.0.0 - 1.47.2" + ] + }, + "promise-js": { + "plugin-name": "promise-js", + "min-version": "0.0.3", + "range": [ + "0.0.3 - 0.0.7" + ] + }, + "promise": { + "plugin-name": "promise", + "min-version": "7.0.0", + "range": [ + "7.0.0 - 7.3.1", + "8.0.0 - 8.3.0" + ] + }, + "q": { + "plugin-name": "q", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.5.1" + ] + }, + "qs": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.6.6", + "1.0.0 - 1.2.2", + "2.0.0 - 2.4.2", + "3.0.0 - 3.1.0", + "4.0.0 - 4.0.0", + "5.0.0 - 5.2.1", + "6.0.0 - 6.13.0" + ] + }, + "@node-redis/client": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.0.6" + ] + }, + "@redis/client": { + "min-version": "1.1.0", + "range": [ + "1.1.0 - 1.6.0" + ] + }, + "redis": { + "plugin-name": "redis", + "min-version": "0.12.0", + "range": [ + "0.12.0 - 0.12.1", + "1.0.0 - 1.0.0", + "2.0.0 - 2.8.0", + "3.0.0 - 3.1.2", + "4.0.0 - 4.7.0" + ] + }, + "restify": { + "plugin-name": "resify", + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.0.3", + "4.0.0 - 4.3.4", + "5.0.0 - 5.2.1", + "6.0.0 - 6.4.0", + "7.0.0 - 7.7.0", + "8.0.0 - 8.6.1", + "9.0.0 - 9.1.0", + "10.0.0 - 10.0.0", + "11.0.0 - 11.1.0" + ] + }, + "rhea": { + "plugin-name": "rhea", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.0.24", + "2.0.0 - 2.0.8", + "3.0.0 - 3.0.3" + ] + }, + "router": { + "plugin-name": "router", + "min-version": "0.2.1", + "range": [ + "0.2.1 - 0.6.2", + "1.0.0 - 1.3.8" + ] + }, + "selenium-webdriver": { + "min-version": "2.29.0", + "range": [ + "2.29.0 - 2.53.3", + "3.0.0 - 3.6.0", + "4.0.0 - 4.25.0" + ] + }, + "sequelize": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.4.3", + "1.0.0 - 1.7.11", + "2.0.0 - 2.1.3", + "3.0.0 - 3.35.1", + "4.0.0 - 4.44.4", + "5.1.0 - 5.22.5", + "6.1.0 - 6.37.3" + ] + }, + "sharedb": { + "plugin-name": "sharedb", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.9.2", + "2.0.0 - 2.2.6", + "3.0.0 - 3.3.2", + "4.0.0 - 4.1.5", + "5.0.0 - 5.0.4" + ] + }, + "tedious": { + "plugin-name": "tedious", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.15.0", + "2.0.0 - 2.7.1", + "3.0.0 - 3.0.1", + "4.0.0 - 4.2.0", + "5.0.0 - 5.0.3", + "6.0.0 - 6.7.1", + "7.0.0 - 7.0.0", + "8.0.0 - 8.3.1", + "9.0.0 - 9.2.3", + "10.0.0 - 10.0.0", + "11.0.0 - 11.8.0", + "12.0.0 - 12.3.0", + "13.0.0 - 13.2.0", + "14.0.0 - 14.7.0", + "15.0.0 - 15.1.3", + "16.0.0 - 16.7.1", + "17.0.0 - 17.0.0", + "18.0.0 - 18.6.2" + ] + }, + "undici": { + "plugin-name": "undici", + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.5.0", + "1.0.0 - 1.3.1", + "2.0.0 - 2.2.1", + "3.0.0 - 3.3.6", + "4.0.0 - 4.16.0", + "5.0.0 - 5.28.4", + "6.0.0 - 6.19.8" + ] + }, + "vitest": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.34.6", + "1.0.0 - 1.6.0", + "2.0.0 - 2.1.1" + ] + }, + "@vitest/runner": { + "min-version": "0.28.0", + "range": [ + "0.28.0 - 0.34.7", + "1.0.0 - 1.6.0", + "2.0.0 - 2.1.1" + ] + }, + "when": { + "plugin-name": "when", + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.7.8" + ] + }, + "winston": { + "plugin-name": "winston", + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.1.2", + "2.0.0 - 2.4.7", + "3.0.0 - 3.14.2" + ] + } + } +} diff --git a/scripts/create_matrix.js b/scripts/create_matrix.js new file mode 100644 index 00000000000..ba0b68e0495 --- /dev/null +++ b/scripts/create_matrix.js @@ -0,0 +1,89 @@ +const path = require('path') +const fs = require('fs') +const yaml = require('js-yaml') +const plugin = require('eslint-plugin-mocha') + +const matricesPath = path.join( + __dirname, + '..', + 'packages', + 'datadog-instrumentations', + 'src', + 'helpers', + 'matrices.json' +) +const versionsPath = path.join( + __dirname, + '..', + 'packages', + 'datadog-instrumentations', + 'src', + 'helpers', + 'versions.json' +) + +const matricesJson = { matrices: {} } + +const versionsJson = require(versionsPath) +const versionsNames = Object.getOwnPropertyNames(yaml.load(fs.readFileSync(versionsPath, 'utf-8')).matrices) + +function generateMatrix () { + let versionsPlugin + let matrix + let pluginName + + for (const name of versionsNames) { + // object is by plugin name + // it has the properties of min-version the minimum version we support + // and it has node-versions tracking version support by node version where applicable + // the first node version will be nested as node-version and range, subsequent node version + // ranges will need to be nested within 'include:' + // if the plugin does not require a node version it will just have a range + + versionsPlugin = versionsJson.matrices[name] + pluginName = versionsJson.matrices[name]['plugin-name'] + + if (!matricesJson.matrices[pluginName]) matricesJson.matrices[pluginName] = {} + + if (versionsPlugin['by-node-version'] === true) { + matrix = { + 'node-version': [], + range: [], + include: {} + } + const range = [] + const plugin = versionsPlugin['node-versions'] + for (const version in plugin) { + range.push({ 'node-version': +version, range: plugin[version] }) + } + + for (let ele = 0; ele < range.length; ele++) { + if (ele === 0) { + matrix['node-version'] = [range[ele]['node-version']] + matrix.range = range[ele].range + } else { + matrix.include = [{ + 'node-version': range[ele]['node-version'], + range: range[ele].range[0] + }] + } + } + matricesJson.matrices[pluginName] = matrix + } else { + matrix = { + range: versionsPlugin.range + } + matricesJson.matrices[pluginName] = matrix + } + } + return matricesJson +} + +module.exports = { + generateMatrix +} + +if (require.main === module) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(generateMatrix())) +} diff --git a/scripts/helpers/versioning.js b/scripts/helpers/versioning.js new file mode 100644 index 00000000000..b51eaafee8b --- /dev/null +++ b/scripts/helpers/versioning.js @@ -0,0 +1,78 @@ +const fs = require('fs') +const path = require('path') +const childProcess = require('child_process') +const proxyquire = require('proxyquire') + +const versionLists = {} +const names = [] + +const filter = process.env.hasOwnProperty('PLUGINS') && process.env.PLUGINS.split('|') + +fs.readdirSync(path.join(__dirname, '../../packages/datadog-instrumentations/src')) + .filter(file => file.endsWith('js')) + .forEach(file => { + file = file.replace('.js', '') + + if (!filter || filter.includes(file)) { + names.push(file) + } + }) + +async function getVersionList (name) { + if (versionLists[name]) { + return versionLists[name] + } + const list = await npmView(`${name} versions`) + versionLists[name] = list + return list +} + +function npmView (input) { + return new Promise((resolve, reject) => { + childProcess.exec(`npm view ${input} --json`, (err, stdout) => { + if (err) { + reject(err) + return + } + resolve(JSON.parse(stdout.toString('utf8'))) + }) + }) +} + +function loadInstFile (file, instrumentations) { + const instrument = { + addHook (instrumentation) { + instrumentations.push(instrumentation) + } + } + + const instPath = path.join(__dirname, `../../packages/datadog-instrumentations/src/${file}`) + + proxyquire.noPreserveCache()(instPath, { + './helpers/instrument': instrument, + '../helpers/instrument': instrument + }) +} + +function getInternals () { + return names.map(key => { + const instrumentations = [] + const name = key + + try { + loadInstFile(`${name}/server.js`, instrumentations) + loadInstFile(`${name}/client.js`, instrumentations) + } catch (e) { + loadInstFile(`${name}.js`, instrumentations) + } + + return instrumentations + }).reduce((prev, next) => prev.concat(next), []) +} + +module.exports = { + getVersionList, + npmView, + loadInstFile, + getInternals +} diff --git a/scripts/outdated.js b/scripts/outdated.js new file mode 100644 index 00000000000..0a363aea944 --- /dev/null +++ b/scripts/outdated.js @@ -0,0 +1,175 @@ +const { + getInternals, + npmView +} = require('./helpers/versioning') +const path = require('path') +const fs = require('fs') +const { execSync } = require('child_process') +const yaml = require('js-yaml') + +// const { generateMatrix } = require('./create_matrix') + +const latestsPath = path.join( + __dirname, + '..', + 'packages', + 'datadog-instrumentations', + 'src', + 'helpers', + 'latests.json' +) + +const matricesPath = path.join( + __dirname, + '..', + 'packages', + 'datadog-instrumentations', + 'src', + 'helpers', + 'matrices.json' +) + +const versionsPath = path.join( + __dirname, + '..', + 'packages', + 'datadog-instrumentations', + 'src', + 'helpers', + 'versions.json' +) + +const latestsJson = require(latestsPath) +const internalsNames = Array.from(new Set(getInternals().map(n => n.name))) + .filter(x => typeof x === 'string' && x !== 'child_process' && !x.startsWith('node:')) + +const versionsJson = require(versionsPath) +const pluginNames = Object.getOwnPropertyNames(yaml.load(fs.readFileSync(matricesPath, 'utf-8')).matrices) + +// TODO A lot of this can be optimized by using `npm outdated`. + +function makeAPR (branchName) { + const title = 'Fix: Update Outdated Versions' + const body = 'Updating outdated integration versions' + execSync(`gh pr create --title ${title} --body ${body} --base master --head ${branchName} `) +} + +function maxVersion (range) { + if (typeof range === 'string') { + return range + } + return range.pop() +} + +async function updateRange (name, major) { + const versionRange = await npmView(`${name}@${major} version`) + + const maxRange = maxVersion(versionRange) + + return maxRange +} + +async function loopRange (name, range) { + for (let ele = 0; ele < range.length; ele++) { + const latest = range[ele].split(' - ') + const major = +latest[0].split('.')[0] + + latest[1] = await updateRange(name, major) + range[ele] = `${latest[0]} - ${latest[1]}` + } + fs.writeFileSync(versionsPath, JSON.stringify(versionsJson, null, 2)) +} + +async function updatePlugin (name) { + const plugin = versionsJson.matrices[name] + + if (plugin['by-node-version'] === true) { + for (const versions in plugin['node-versions']) { + const pluginRange = plugin['node-versions'] + loopRange(name, pluginRange[versions]) + } + } else { + loopRange(name, plugin.range) + } +} + +async function fix () { + for (const name of pluginNames) { + await updatePlugin(name) + } + + const result = execSync('git status').toString() + + if (result.includes(versionsPath)) { + const branchName = 'update_outdated_integrations' + try { + execSync(`git checkout -b ${branchName}`) + execSync(`git add ${versionsPath}`) + execSync('git commit -m "fix: update integr versions.json"') + execSync(`git push origin ${branchName}`) + + makeAPR(branchName) + } catch (e) { + console.log('ERROR', e) + process.exitCode = 1 + } + } +} + +async function check () { + for (const name of internalsNames) { + const latest = latestsJson.latests[name] + if (!latest) { + console.log(`No latest version found for "${name}"`) + process.exitCode = 1 + } + const distTags = await npmView(name + ' dist-tags') + const npmLatest = distTags.latest + if (npmLatest !== latest) { + console.log(`"latests.json: is not up to date for "${name}": expected "${npmLatest}", got "${latest}"`) + process.exitCode = 1 + } + } +} + +function minVersion (range) { + if (typeof range === 'string') { + return range + } + return range.shift() +} +async function ranges (name, minimum) { + const distTags = await npmView(`${name} dist-tags`) + const latestVersion = splitting(distTags?.latest) + + const splitMin = splitting(minimum) + + const ranges = [] + let versionRange + let maxRange + let minRange + + for (let major = splitMin; major <= latestVersion; major++) { + try { + versionRange = await npmView(`${name}@${major} version`) + maxRange = maxVersion(versionRange) + minRange = minVersion(versionRange) + + if (major === splitMin) { + ranges.push(`${minimum} - ${maxRange}`) + } else if (versionRange !== undefined) { + ranges.push(`${minRange} - ${maxRange}`) + } + } catch (e) { + console.log(`No version range found for "${name}" at version ${major}`) + } + } + return ranges +} + +function splitting (element) { + return +element.split('.')[0] +} + +if (process.argv.includes('fix')) fix() +else check()