Skip to content

v5.57.0 proposal #5893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 41 commits into
base: v5.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bb04814
feat: add config DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED / remove exper…
anna-git Jun 12, 2025
44d1475
Reduce false positives when unvalidated redirect vulnerability is det…
uurien Jun 12, 2025
cec75b9
Add blocking for fastify query and body (#5806)
IlyasShabi Jun 12, 2025
310a6bf
chore(ssi): send injection and instrumentation telemetry (#5721)
mabdinur Jun 12, 2025
0c561ec
add explicit main ref when checking out system tests in workflow (#5892)
rochdev Jun 12, 2025
e82f07b
ci: fix bug with GitLab CI (#5895)
watson Jun 13, 2025
339fb05
test: clean up usage of agent.assertTelemetryReceived (#5883)
watson Jun 13, 2025
6324a06
Update to libdatadog-nodejs 0.7.0 (#5896)
szegedi Jun 13, 2025
f96fc52
Fix router not working with deeply nested middleware (#5890)
BridgeAR Jun 14, 2025
5d68299
[test-optimization] [SDTEST-2163] Check framework version in capabili…
Mariovido Jun 16, 2025
7bebc92
Revert "Update to libdatadog-nodejs 0.7.0 (#5896)" (#5902)
watson Jun 17, 2025
2b86c31
[test optimization] Update test optimization spec (#5897)
juan-fernandez Jun 17, 2025
27b0f91
[test optimization] Improve flakiness of performance overhead test (#…
juan-fernandez Jun 17, 2025
54fac33
test: sort config value assertions (#5899)
watson Jun 17, 2025
a76d78a
Revert "Revert "Update to libdatadog-nodejs 0.7.0 (#5896)" (#5902)" (…
szegedi Jun 17, 2025
abe0b60
[test-optimization] [SDTEST-1060] Add mocked files of Jest to the lis…
Mariovido Jun 17, 2025
e17803a
Remove explicit AbortSignal reason (#5904)
CarlesDD Jun 17, 2025
6827531
Improve support for esbuild + esm with DD_BUILD_ESM env var (#5888)
uurien Jun 17, 2025
62b7263
update flakiness report with min occurrences and merge matrix runs (#…
rochdev Jun 17, 2025
34b26f7
Fix flakiness detection script typo (#5907)
rochdev Jun 17, 2025
d843538
Allow blocking on fastify path params (#5889)
IlyasShabi Jun 18, 2025
853efea
Support schema extraction in fastify response objects (#5894)
IlyasShabi Jun 18, 2025
bafba3f
wrapCommandQueueClass fix super call (#5911)
BridgeAR Jun 19, 2025
a6ce720
fix: Add mongo heartbeatEnabled param to tracer entrypoint (#5912)
BridgeAR Jun 19, 2025
349da35
Simplify config.js by removing _setValue helper (#5855)
BridgeAR Jun 19, 2025
3ac9bfe
Update mocha to ^v11.6.0 (#5908)
BridgeAR Jun 19, 2025
6bb9fb7
Detect destructuring process.env and use the config-helper instead (#…
BridgeAR Jun 19, 2025
6b45993
Clean up code in Crashtracker class (#5917)
watson Jun 20, 2025
d479686
Reduce computation overhead for inactive complex log messages (#5916)
watson Jun 20, 2025
45775cd
ci(langchain): skip latest langchain in ci until mocking is fixed (#5…
sabrenner Jun 20, 2025
300f133
Fix detection of stacks originating from dd-trace (#5773)
watson Jun 20, 2025
cea69e7
[DI] Improve internal timer performance (#5922)
watson Jun 23, 2025
1e4fef9
feat(tracer): implement process discovery feature (#5782)
dmehala Jun 23, 2025
de8d51a
Code cleanup: Improve calculation of number of bytes in string (#5924)
watson Jun 23, 2025
6a0d832
Ensure collected data is sent to the agent even if flushInterval is n…
watson Jun 23, 2025
ce72b57
docs: fix bug in docs related to running tests (#5926)
watson Jun 23, 2025
9abe6e9
Support for Prisma client library (#5605)
bojbrook Jun 23, 2025
db67ba6
Update .gitlab/one-pipeline.locked.yml (#5932)
pawelchcki Jun 23, 2025
7d60a94
Enable log injection by default for structured loggers (#5859)
ida613 Jun 23, 2025
d94a801
fix(esbuild): call the hook function properly in the bundler register…
sabrenner Jun 23, 2025
e1074ca
v5.57.0
rochdev Jun 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/apm-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,21 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/plugins/test
prisma:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:9.5
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
env:
PLUGINS: prisma
SERVICES: prisma
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/plugins/test

protobufjs:
runs-on: ubuntu-latest
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/appsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ jobs:
- run: yarn test:appsec:plugins:ci
- uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2

fastify:
runs-on: ubuntu-latest
env:
PLUGINS: fastify
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/node/oldest-maintenance-lts
- uses: ./.github/actions/install
- run: yarn test:appsec:plugins:ci
- uses: ./.github/actions/node/active-lts
- run: yarn test:appsec:plugins:ci
- uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2

graphql:
runs-on: ubuntu-latest
env:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/flakiness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Flakiness Report

on:
schedule:
- cron: '0 6 * * *'
- cron: '0 6 * * 1'

jobs:
flakiness:
Expand All @@ -11,6 +11,8 @@ jobs:
actions: read
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DAYS: '7'
OCCURRENCES: '2'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,15 @@ jobs:
integration-guardrails:
strategy:
matrix:
version: [14.0.0, 14, 16.0.0, eol, 18.0.0, 18.1.0, 20.0.0, 22.0.0]
version: [14.0.0, 14, 16.0.0, 18.0.0, 20.0.0, 22.0.0, 24.0.0]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: yarn add --ignore-scripts mocha@10 # Use older mocha to support old Node.js versions
- run: node node_modules/.bin/mocha --colors --timeout 30000 integration-tests/init.spec.js

integration-guardrails-unsupported:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'DataDog/system-tests'
ref: 'main'
- name: Checkout dd-trace-js
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-optimization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
with:
token: ${{ steps.app-token.outputs.token }}
- uses: ./.github/actions/node/oldest-maintenance-lts
- name: CI Visibility Performance Overhead Test
run: yarn bench:e2e:ci-visibility
- name: Test Optimization Performance Overhead Test
run: yarn bench:e2e:test-optimization
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

Expand Down
2 changes: 1 addition & 1 deletion .gitlab/one-pipeline.locked.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DO NOT EDIT THIS FILE MANUALLY
# This file is auto-generated by automation.
include:
- remote: https://gitlab-templates.ddbuild.io/libdatadog/one-pipeline/ca/05e116339b9780a138a474d0348e97debfca97f27bbc4ca489cf4e4c90d9cc94/one-pipeline.yml
- remote: https://gitlab-templates.ddbuild.io/libdatadog/one-pipeline/ca/da9922e97994c97cdeca1c9a515fff18a9581a70d0cc1c921bd623c648d1caf8/one-pipeline.yml
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Before running _plugin_ tests, the supporting docker containers need to be runni

Instead, you can follow this procedure for the plugin you want to run tests for:

1. Check the CI config in `.github/workflows/plugins.yml` to see what the appropriate values for the `SERVICES` and `PLUGINS` environment variables are for the plugin you're trying to test (noting that not all plugins require `SERVICES`). For example, for the `amqplib` plugin, the `SERVICES` value is `rabbitmq`, and the `PLUGINS` value is `amqplib`.
1. Check the CI config in `.github/workflows/*.yml` to see what the appropriate values for the `SERVICES` and `PLUGINS` environment variables are for the plugin you're trying to test (noting that not all plugins require `SERVICES`). For example, for the `amqplib` plugin, the `SERVICES` value is `rabbitmq`, and the `PLUGINS` value is `amqplib`.
2. Run the appropriate docker-compose command to start the required services. For example, for the `amqplib` plugin, you would run: `docker compose up -d rabbitmq`.
3. Run `yarn services`, with the environment variables set above. This will install any versions of the library to be tested against into the `versions` directory, and check that the appropriate services are running prior to running the test.
4. Now, you can run `yarn test:plugins` with the environment variables set above to run the tests for the plugin you're interested in.
Expand All @@ -117,8 +117,8 @@ To wrap that all up into a simple few lines of shell commands, here is all of th

```sh
# These are exported for simplicity, but you can also just set them inline.
export SERVICES="rabbitmq" # retrieved from .github/workflows/plugins.yml
export PLUGINS="amqplib" # retrieved from .github/workflows/plugins.yml
export SERVICES="rabbitmq" # retrieved from .github/workflows/apm-integrations.yml
export PLUGINS="amqplib" # retrieved from .github/workflows/apm-integrations.yml

docker compose up -d $SERVICES
yarn services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
/* eslint-disable no-console */

const https = require('https')
const { setTimeout } = require('timers/promises')

const API_REPOSITORY_URL = 'https://api.github.com/repos/DataDog/test-environment'
const DISPATCH_WORKFLOW_URL = `${API_REPOSITORY_URL}/actions/workflows/dd-trace-js-tests.yml/dispatches`
const GET_WORKFLOWS_URL = `${API_REPOSITORY_URL}/actions/runs`

const MAX_ATTEMPTS = 30 * 60 / 5 // 30 minutes, polling every 5 seconds = 360 attempts

function getBranchUnderTest () {
/**
* GITHUB_HEAD_REF is only set for `pull_request` events
Expand Down Expand Up @@ -106,17 +109,9 @@ const getCurrentWorkflowJobs = (runId) => {
})
}

const wait = (timeToWaitMs) => {
return new Promise(resolve => {
setTimeout(() => {
resolve()
}, timeToWaitMs)
})
}

async function main () {
// Trigger JS GHA
console.log('Triggering CI Visibility test environment workflow.')
console.log('Triggering Test Optimization test environment workflow.')
const httpResponseCode = await triggerWorkflow()
console.log('GitHub API response code:', httpResponseCode)

Expand All @@ -125,7 +120,7 @@ async function main () {
}

// Give some time for GH to process the request
await wait(15000)
await setTimeout(15000)

// Get the run ID from the workflow we just triggered
const workflowsInProgress = await getWorkflowRunsInProgress()
Expand All @@ -143,30 +138,35 @@ async function main () {
console.log(`Workflow URL: https://github.com/DataDog/test-environment/actions/runs/${runId}`)

// Wait an initial 1 minute, because we're sure it won't finish earlier
await wait(60000)

// Poll every 5 seconds until we have a finished status
await new Promise((resolve, reject) => {
const intervalId = setInterval(async () => {
const currentWorkflow = await getCurrentWorkflowJobs(runId)
const { jobs } = currentWorkflow
const hasAnyJobFailed = jobs.some(({ status, conclusion }) => status === 'completed' && conclusion !== 'success')
const hasEveryJobPassed = jobs.every(
({ status, conclusion }) => status === 'completed' && conclusion === 'success'
)
if (hasAnyJobFailed) {
reject(new Error(`Performance overhead test failed.
Check https://github.com/DataDog/test-environment/actions/runs/${runId} for more details.`))
clearInterval(intervalId)
} else if (hasEveryJobPassed) {
console.log('Performance overhead test successful.')
resolve()
clearInterval(intervalId)
} else {
console.log(`Workflow https://github.com/DataDog/test-environment/actions/runs/${runId} is not finished yet.`)
}
}, 5000)
})
await setTimeout(60000)

// Poll every 5 seconds until we have a finished status, up to 30 minutes
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
const currentWorkflow = await getCurrentWorkflowJobs(runId)
const { jobs } = currentWorkflow
if (!jobs) {
console.error('Workflow check returned unknown object %o. Retry in 5 seconds.', currentWorkflow)
await setTimeout(5000)
continue
}
const hasAnyJobFailed = jobs
.some(({ status, conclusion }) => status === 'completed' && conclusion !== 'success')
const hasEveryJobPassed = jobs.every(
({ status, conclusion }) => status === 'completed' && conclusion === 'success'
)
if (hasAnyJobFailed) {
throw new Error(`Performance overhead test failed.\n Check https://github.com/DataDog/test-environment/actions/runs/${runId} for more details.`)
} else if (hasEveryJobPassed) {
console.log('Performance overhead test successful.')
break
} else {
console.log(`Workflow https://github.com/DataDog/test-environment/actions/runs/${runId} is not finished yet. [Attempt ${attempt + 1}/${MAX_ATTEMPTS}]`)
}
if (attempt === MAX_ATTEMPTS - 1) {
throw new Error(`Timeout: Workflow did not finish within 30 minutes. Check https://github.com/DataDog/test-environment/actions/runs/${runId} for more details.`)
}
await setTimeout(5000)
}
}

main().catch(e => {
Expand Down
2 changes: 2 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ tracer.use('pg', {
<h5 id="pg"></h5>
<h5 id="pg-tags"></h5>
<h5 id="pg-config"></h5>
<h5 id="prisma"></h5>
<h5 id="protobufjs"></h5>
<h5 id="redis"></h5>
<h5 id="redis-tags"></h5>
Expand Down Expand Up @@ -147,6 +148,7 @@ tracer.use('pg', {
* [oracledb](./interfaces/export_.plugins.oracledb.html)
* [pino](./interfaces/export_.plugins.pino.html)
* [pg](./interfaces/export_.plugins.pg.html)
* [primsa](./interfaces/export_.plugins.prisma.html)
* [promise](./interfaces/export_.plugins.promise.html)
* [promise-js](./interfaces/export_.plugins.promise_js.html)
* [protobufjs](./interfaces/export_.plugins.protobufjs.html)
Expand Down
1 change: 1 addition & 0 deletions docs/add-redirects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ declare -a plugins=(
"oracledb"
"pino"
"pg"
"prisma"
"promise"
"promise_js"
"protobufjs"
Expand Down
1 change: 1 addition & 0 deletions docs/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ tracer.use('playwright');
tracer.use('pg');
tracer.use('pg', { service: params => `${params.host}-${params.database}` });
tracer.use('pino');
tracer.use('prisma');
tracer.use('protobufjs');
tracer.use('redis');
tracer.use('redis', redisOptions);
Expand Down
37 changes: 31 additions & 6 deletions eslint-rules/eslint-process-env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default {
meta: {
type: 'problem',
docs: {
description: 'Disallow usage of process.env outside config.js'
description: 'Disallow usage of process.env outside config-helper.js'
},
schema: []
},
Expand All @@ -23,27 +23,52 @@ export default {
return {
// Handle direct member expressions: process.env.FOO
MemberExpression (node) {
if (node.object?.type === 'MemberExpression' &&
isProcessEnvObject(node.object)) {
// direct `process.env` or nested `process.env.FOO`
if (isProcessEnvObject(node) ||
node.object?.type === 'MemberExpression' && isProcessEnvObject(node.object)) {
report(node)
}
},

// Handle destructuring: const { FOO } = process.env
VariableDeclarator (node) {
if (isProcessEnvObject(node.init)) {
if (
node.init?.type === 'MemberExpression' &&
isProcessEnvObject(node.init) &&
node.id.type === 'Identifier'
) {
// const env = process.env
report(node)
} else if (
node.init?.type === 'Identifier' &&
node.init.name === 'process' &&
node.id.type === 'ObjectPattern'
) {
// const { env } = process
for (const prop of node.id.properties) {
if (prop.type === 'Property' && prop.key.name === 'env') {
report(node)
break
}
}
}
// const { FOO } = process.env
if (
node.init?.type === 'MemberExpression' &&
isProcessEnvObject(node.init)
) {
report(node)
}
},

// Handle spread operator: { ...process.env }
// Spread usage: { ...process.env } or { ...envAlias }
SpreadElement (node) {
if (isProcessEnvObject(node.argument)) {
report(node)
}
},

// Handle any function call with process.env as an argument
// Any function call receiving process.env
CallExpression (node) {
for (const arg of node.arguments) {
if (isProcessEnvObject(arg)) {
Expand Down
34 changes: 34 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ interface Plugins {
"playwright": tracer.plugins.playwright;
"pg": tracer.plugins.pg;
"pino": tracer.plugins.pino;
"prisma": tracer.plugins.prisma;
"protobufjs": tracer.plugins.protobufjs;
"redis": tracer.plugins.redis;
"restify": tracer.plugins.restify;
Expand Down Expand Up @@ -1271,6 +1272,15 @@ declare namespace tracer {
meta?: boolean;
}

/** @hidden */
interface Prisma extends Instrumentation {}

/** @hidden */
interface PrismaClient extends Prisma {}

/** @hidden */
interface PrismaEngine extends Prisma {}

/**
* This plugin automatically instruments the
* [aerospike](https://github.com/aerospike/aerospike-client-nodejs) for module versions >= v3.16.2.
Expand Down Expand Up @@ -1820,6 +1830,13 @@ declare namespace tracer {
* [mongodb-core](https://github.com/mongodb-js/mongodb-core) module.
*/
interface mongodb_core extends Instrumentation {
/**
* Whether to enable mongo heartbeats spans.
*
* @default true
*/
heartbeatEnabled?: boolean;

/**
* Whether to include the query contents in the resource name.
*/
Expand Down Expand Up @@ -1927,6 +1944,23 @@ declare namespace tracer {
* on the tracer.
*/
interface pino extends Integration {}

/**
* This plugin automatically instruments the
* [@prisma/client](https://www.prisma.io/docs/orm/prisma-client) module.
*/
interface prisma extends PrismaClient, PrismaEngine {
/**
* Configuration for prisma client.
*/
client?: PrismaClient | boolean,

/**
* Configuration for Prisma engine.
*/
engine?: PrismaEngine | boolean
}

/**
* This plugin automatically patches the [protobufjs](https://protobufjs.github.io/protobuf.js/)
* to collect protobuf message schemas when Datastreams Monitoring is enabled.
Expand Down
5 changes: 4 additions & 1 deletion init.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
var guard = require('./packages/dd-trace/src/guardrails')

module.exports = guard(function () {
return require('.').init()
var INSTRUMENTED_BY_SSI = require('./packages/dd-trace/src/constants').INSTRUMENTED_BY_SSI
var obj = {}
obj[INSTRUMENTED_BY_SSI] = 'ssi'
return require('.').init(obj)
})
Loading
Loading