Repository navigation
v5.102.0 proposal - #8339
Merged
Merged
v5.102.0 proposal#8339
Conversation
) Three DSM tests have been flaking on master with "KafkaJSProtocolError: This server does not host this topic-partition", thrown from consumer.subscribe -> Cluster.refreshMetadata in beforeEach. Root cause: createTopics({ waitForLeaders: false }) returns as soon as the controller acks topic creation, before partition leaders are elected and propagated. The immediate consumer.subscribe call then lands a metadata refresh on a broker that does not yet host the partition leader. Flip the flag to true (which is also the kafkajs default) so the admin call waits for leader election before returning. Apply the same fix to the sister index.spec.js, which has the same anti-pattern but has so far been masked by producer-first test ordering. Verified locally with 20 consecutive green runs of dsm.spec.js.
* chore(ci): pin all Docker images to SHA digests
Pin every Docker image reference in docker-compose.yml and GitHub
Actions workflows to its manifest-list SHA digest, matching the
pattern already used for GitHub Actions versions. The original
tag is preserved as an inline comment for readability.
Two exceptions:
- bitnami/openldap:latest – image no longer available on Docker Hub
- aerospike:${{ matrix.aerospike-image }} – dynamic matrix variable,
cannot be pinned statically
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* chore(ci): add lint check for unpinned Docker image references
Adds scripts/check-docker-image-shas.js which scans all tracked YAML
files and fails if any `image:` reference does not use the
`name@sha256:<digest> # tag` form. Wired into `npm run lint` alongside
the existing check-no-mcr-images check.
Skips dynamic GitHub Actions expressions (${{ ... }}), plain env-var
references ($VAR), and a small explicit allowlist for images that
genuinely cannot be pinned at this time.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(ci): pin bitnami/openldap to bitnamilegacy and remove allowlist
bitnami/openldap:latest returns 404 on Docker Hub; the correct image is
bitnamilegacy/openldap:latest (already used in appsec.yml). Update
docker-compose.yml to match and pin it to its SHA digest.
With no remaining exceptions, drop the ALLOWED_UNPINNED allowlist from
the check-docker-image-shas script entirely.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* chore(ci): move aerospike image ref into matrix so SHA check applies
Rename matrix key aerospike-image → image and embed the full
aerospike@sha256: reference directly in each matrix entry. The service
container now references ${{ matrix.image }}, which the SHA validator
skips (it's an expression), but the matrix value lines themselves are
plain `image:` YAML entries that the validator does check.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(ci): move comment outside flow sequence for aerospike base image
A # inside a quoted YAML flow sequence string is not a comment — it
becomes part of the value, making the Docker image reference invalid.
Move the version comment after the closing bracket where YAML treats
it as a real comment.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* chore(ci): improve check-docker-image-shas error message
Replace the dead-end reference to a non-existent script with a clear,
actionable message pointing to the image's registry page.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* chore(ci): add aerospike job name to use version instead of SHA
Add an aerospike-version matrix key and a name: field so job names
show the readable version tag (e.g. ce-6.4.0.3) rather than the full
SHA digest.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
#8233) * perf(encode): drop the per-span filter Array allocations in the 0.4 encoder Each of `_encodeMap`, `_encodeMetaStruct`, `_encodeObjectAsMap`, and `_encodeObjectAsArray` walked the input twice -- once via `Object.keys(value).filter(k => typeof value[k] === 'string' || ...)` to build a pre-filtered `validKeys` Array, then over that Array to emit pairs. Each call allocates the closure plus the `validKeys` Array; the encoder runs once per finished span on the flush path, and each span flushes through `_encodeMap` for `meta` and `metrics`, so that's at minimum two allocations per span before any nested `meta_struct`. Walk the input twice instead -- once to count valid entries (no allocations, just typeof checks), once to emit pairs. Same time complexity, lower constant factor: ~13% faster on the typical span `meta` shape (10 string/number keys + 1 dropped). For `_encodeObjectAsArray` the `validValue` Array (sized to the surviving items) is replaced with a `{ length: validCount }` shape passed to `_encodeArrayPrefix`, which only reads `.length`. Drive-by experiment: the audit also suggested narrowing the per-span `try/catch` in `agentless-json.js` to wrap only the `JSON.stringify` call. A 1-second microbench against a realistic span shows wide 3.19 Mops/s vs narrow 3.21 Mops/s -- inside the noise band, modern V8 does not penalise a function-scope `try/catch` around the hot work. Leave the wide catch as-is; the narrower variant would lose the formatSpan / spanToJSON defensive coverage for no measurable win. * perf(encode): specialize the 0.4 encoder hot path This is mainly a performance improvement for the agent-encoding hot path. The 0.4 encoder runs once per exported trace, so the previous two-pass map walk, per-call `Uint8Array` view allocations, and V8 dictionary-mode transitions from `delete` all amortized poorly. The following improvements are implemented: 1. The string cache now stores the encoded fixstr/str32 bytes as a Buffer subarray instead of `{ start, end }`. Each `_encodeString` cache hit becomes one map lookup plus a native `Uint8Array.set`, with no per-call view allocation. 2. `_encodeMap` runs a single pass with a count-and-patch slot. The dedicated typeof-only pre-loop is gone, and the polymorphic `_encodeValue` switch is split into specialized string and number branches at the call site. 3. The span-level keys (`trace_id`, `span_id`, `meta`, …) and their value prefix bytes are pre-encoded at module load. The hot loop emits each via one `bytes.set` and skips the cache entirely. For the ID, error, start, and duration fields the key + value-prefix byte are fused into a single buffer so each field is one `bytes.reserve` instead of two. 4. `formatSpanEvents` and `convertSpanEventAttributeValues` are gone. A specialized `#encodeSpanEvents` walks the raw events directly and emits OTel typed wrappers inline (`[0x82, 'type', N, '*_value', value]`), bypassing both the pre-conversion mutation and the recursive generic walker. Filter-out is handled by rewinding `bytes.length` instead of counting twice. With the native-events config picked once at construction, the hot path also no longer pays a per-span `config.trace.nativeSpanEvents` check. 5. Every `delete` in the format pipeline becomes `= undefined`. `delete span.span_events` (and the two attribute-filter deletes inside event formatting) would push every event-bearing span and attribute object into V8 dictionary mode for the rest of its lifetime; the encoder skips undefined-valued keys, so the wire output stays unchanged. Wire format stays decoder-compatible. The only changes are fixmap (`0x82` / `0x83`) in place of `0xDF + 4-byte count` for the span-event outer map and the typed-wrapper inner map, fixmap(1) for `array_value`, and a fixint type discriminator instead of float64. All decode to identical JS structures and the existing span_events tests verify each shape against the pre-existing expected output. Drive-by fix: * `MsgpackChunk._minSize` / `_resize` and the encoder's `_msgpack`, `_limit`, `_writer`, `_config`, `_debugEncoding` move to `#private`. The 0.4 spec test that toggled `_debugEncoding` now injects `DD_TRACE_ENCODING_DEBUG: true` via the proxyquired config rather than poking the field after construction. Microbench, 20k traces × 30 spans: * 0.4 with native span events: ~644k → ~1.05M spans/s. * 0.4 with legacy span events: ~644k → ~770k spans/s. * 0.4 spans without events: ~430k → ~1.45M spans/s. * 0.5 spans without events: ~1.34M → ~2.55M spans/s. * perf(encode): emit span fixed fields in a single reserve The map prefix byte, the optional `type` field, the three IDs, and the `name` / `resource` / `service` strings used to be seven separate `bytes.reserve` + `Uint8Array.set` round trips. They're all known sizes once the cached string entries are pre-fetched, so they can collapse into one `bytes.reserve` covering the whole block followed by sequential native writes into the freshly-grown buffer. `_encode` now: 1. Looks up `name` / `resource` / `service` (and `type` when present) in the string cache up front. 2. Sums the block size from the known key-buffer lengths and the cached value-entry lengths. 3. Reserves once, then writes the map prefix byte, the optional type field, the three ID fields (via the new no-reserve `#writeIdAt` helper), and the three string fields directly into the buffer. `error` / `start` / `duration` and the meta / metrics / span_events / meta_struct sections stay on their own reserves because their value sizes only become known during encoding. `#writeIdField` and `#writeKeyAndString` had no callers left after this and are removed; net the file shrinks. * perf(encode): hand-write the legacy span_events stringifier Both `0.4` (in legacy mode) and `0.5` (always) serialize `span.span_events` into a JSON string and hang it off `span.meta.events` for agents that don't support the native top-level slot. `JSON.stringify` is the dominant cost on event-bearing spans. The shape is fixed by `extractSpanEvents` (`{ name, time_unix_nano, attributes? }`) and attribute values are pre-sanitized to primitives or arrays of primitives, so the stringifier doesn't need to handle cycles, `toJSON` hooks, replacer callbacks, or symbols. A specialized walker that emits the JSON string directly is ~7 % faster than `JSON.stringify` on a representative event payload — measured standalone — and produces byte-for-byte identical output for the post-sanitization shape. The hot piece is `escapeJsonString`: it scans the string once for `"`, `\`, or any control char in U+0000–U+001F and, if none is present, returns `"<str>"` directly. Strings that need escaping fall back to `JSON.stringify` to keep surrogate-pair / lone-surrogate handling correct. Numbers go through `Number.isFinite` to match `JSON.stringify`'s `NaN`/`Infinity` → `null` collapse. `stringifySpanEvents` is exported from `0.4.js` and reused from `0.5.js` — the wire shape is identical so a second copy would only invite drift. End-to-end this lifts `0.5 with-events` and `0.4 (legacy) with-events` by ~3-5 %; the standalone stringify win is larger but the overall encode pipeline has plenty of other work per span.
This drops `datadog-instrumentations/src/net.js` from the stack trace of unhandled socket errors. The crash itself is unchanged: a socket without an `'error'` listener still terminates the process, which is upstream behaviour. The dd-trace frame just made the integration look like the cause. The wrap on `Socket.emit` only needs to live until `'ready'` and `'connect'` bind the parent context (see `addTraceBind` in `tcp.js`). It now restores the original emit after both have fired, and on `'error'` / `'close'` for the pre-connect failure path, instead of staying for the lifetime of the socket. Fixes: #3866
* refactor(azure-functions): move span group collection helper to FakeAgent Add collectGroups() to FakeAgent and refactor EH/SB specs to use it, eliminating the duplicated collectingAssert/isXInvokeGroup helpers per BridgeAR's review. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix(azure-functions): use correct span name in batch-links-disabled tests The tryAdd assertions were checking for 'azure.functions.create' which is not a span name emitted by the tracer. The actual names are 'azure.eventhubs.create' and 'azure.servicebus.create', so the absence check was trivially passing. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…#8231) * perf(aws-sdk): cache instrumentation handles and dedupe per-call work The AWS instrumentation runs inside customer code on every traced SDK call, so per-send work compounds. The cleanups below all live on the same per-call code path. The instrumentation hook (`packages/datadog-instrumentations/src/ aws-sdk.js`) cached the seven diagnostic-channel handles per service slug in a `Map`, the stripped Client / Command class names per constructor in `WeakMap`s, and the `getChannelSuffix` slug list in a module-scope `Set`. The Command-class wrap of `deserialize` was running `shimmer.wrap(command, ...)` per-send; when `command.deserialize` is inherited from the prototype (the `@aws-sdk/client-*` v3 default) it now wraps the prototype once via a `patchedCommandPrototypes` `WeakSet`, mirroring the `patchedClientConfigProtocols` pattern directly below. Per-instance wrap remains the fallback for shapes that override `deserialize` as an own property. The plugin (`packages/datadog-plugin-aws-sdk/`) drops several full JSON round-trips on customer payloads. A new `BaseAwsSdkPlugin.injectFieldIntoJsonObject` static helper splices `,"<key>":<value>` before the trailing `}` when the payload ends cleanly and does not already carry the key, falling back to `JSON.parse` + assign + `JSON.stringify` only when the cheap path can't match. EventBridge `Detail`, Step Functions `input`, and Lambda `ClientContext.custom` use it; the no-`ClientContext` path in Lambda skips parsing entirely. SQS stringifies `ddInfo` once after both `tracer.inject` and `DsmPathwayCodec.encode` have populated it, and `responseExtract` returns the parsed Body so `responseExtractDSMContext` reuses it for `message[0]` instead of re-parsing. Kinesis stringifies each record once for both the 1 MiB size check and the outgoing Buffer, and the response-side `JSON.parse` is wrapped in `try`/`catch` so a non-JSON record skips DSM extraction without throwing through the response handler. A new `util.js#isEmpty` / `hasAtLeast` pair replaces every `Object.keys(x).length === 0` and `Object.keys(x).length >= N` emptiness / quota check on the SQS, SNS, and Kinesis inject paths. The for-in shape they wrap is what makes them cheap — it's the only allocation-free shape in JS for the check, and a microbench across empty, 1-key, 4-key, and 10-key objects pins it as 1.24-1.36x faster than `Object.keys(x).length`. Drive-by fix: * `extractResponseBody` swaps `Object.entries(...).filter(...)` + `Object.fromEntries(...)` for a module-scope `Set` of the AWS SDK envelope keys plus a `{...response}` spread followed by `delete`s for each excluded key. `hasOwnProperty` becomes `Object.hasOwn`. * `sqs.js responseExtractDSMContext` hoists `params.QueueUrl.slice(QueueUrl.lastIndexOf('/') + 1)` out of the per-message receive loop, and `sns.js generateTags` reads the trailing ARN segment via `slice(lastIndexOf(':') + 1)` instead of `split(':').at(-1)`. Each saves an Array allocation per call. * `wrapDeserialize` changes from `(deserialize, channelSuffix, responseIndex)` to `(deserialize, headersCh, responseIndex)` since the cached channel handle is what the caller already has. * perf(aws-sdk): drop arguments mutation, narrow inject try/catch, build response body without spread+delete Three focused wins on the AWS SDK instrumentation hot path: 1. `wrapRequest` (`@aws-sdk` v2). Setting `arguments[0] = wrapCb(...)` forced V8 to materialise the arguments object on every call, deopting both `wrappedRequest` and the downstream `send.apply(this, arguments)`. `Request.send` only accepts an optional callback in both v2 and v3 SDKs, so dispatch the (at most one-arg) call site through explicit `runStores(ctx, send, this, wrappedCb)` / `runStores(ctx, send, this)` branches and let V8 keep the optimised function. 2. `requestInject` in `eventbridge.js`, `stepfunctions.js`, and `lambda.js`. The `try/catch` covered the entire body, including `tracer.inject`, `Buffer.byteLength`, and `Buffer.from(..., 'base64').toString('utf8')` -- none of which throw on the inject path. The only throwing surface is the `JSON.parse` slow path inside `BaseAwsSdkPlugin.injectFieldIntoJsonObject` (and the inline `JSON.parse(clientContextJson)` in the lambda `"custom"` branch). Narrow the catch to wrap only those calls so the rest of each inject stays in V8's optimisable surface and any future bug in `tracer.inject` actually surfaces in CI instead of being silently logged. Behaviourally equivalent for the malformed-JSON path that the catch was guarding. 3. `BaseAwsSdkPlugin#extractResponseBody`. `{ ...response }` followed by `delete body[key]` for the four metadata keys allocated a copy and then pushed the copy into V8 dictionary mode for every SDK response. Filter on build instead -- only copy the keys we want. Bench (typical 4-of-8-keys SNS/SQS response shape): - spread + delete : 4.7 Mops/s - filter on build : 11.0 Mops/s (+2.35x) `sns.js`'s `delete params.MessageAttributes._datadog` is left in place: the surrounding `params` is the customer's request and the AWS SDK serialiser walks `MessageAttributes` by `Object.keys`, so dropping our placeholder via assignment to `undefined` would surface a stub key the serialiser would have to render.
Three nock 13 simulation details leak into the test setup and break
under nock 14's mswjs/interceptors backend.
1. Replace plain-object `replyWithError({ code: 'ECONNRESET' })` at the
four remaining sites with real `Error` instances. nock 14 stopped
auto-promoting these into `Error`s, so the request never sees a
retriable failure and the test hangs.
2. UDS / windows-pipe parse tests assert directly on `options.socketPath`
via a `http.request` spy. That is the contract `parseUrl()` owes the
caller for `unix:` URLs.
3. `defaults the request timeout to 2 seconds` switches to a `http.request`
spy. mswjs creates a `ClientRequest` subclass whose own setTimeout
swallows the abort path, so a real-timer test cannot fire here; live
timeout coverage stays in `should have a configurable timeout`.
Refs: #8280
* perf(appsec): defer WAF Set clone and reuse metrics object per run
`run()` paid two per-call allocations the common path threw away:
1. `new Set(this.addressesToSkip)` cloned the skip set up front, but
the only branch that adds to it (`preventDuplicateAddresses`)
fires for at most one address per run. Clone lazily inside that
branch instead.
2. The 10-key `metrics` literal was rebuilt every run.
`Reporter.reportMetrics` reads its fields synchronously without
retaining the reference, so preallocate on the wrapper and reset
the nine mutable fields at the top of `run()`.
`rulesVersion` / `wafVersion` keep their constructor-time values.
Bench (Node 24.13 / V8 13.6, n=1 M+ x 7 trials, drop best+worst):
Set clone + 10-key alloc 17.44 ns/op
lazy clone + reused metrics 4.47 ns/op speedup: 3.90x
* perf(appsec): use shared isEmpty helper and one-walk header filter
Two per-request allocations on the AppSec hot path:
1. Replace the local `isEmptyObject` with the shared `isEmpty` helper
from `../util`.
2. `requestHeaders = { ...req.headers }; delete requestHeaders.cookie`
walked the keys twice and forced a hidden-class transition for the
dropped property. A single-pass `copyHeadersOmitting` builds the
trimmed copy in one walk; same shape applied to the `set-cookie`
strip in `onResponseWriteHead`.
Bench (Node 24.13 / V8 13.6, n=1 M+ x 7 trials, 8-key headers):
{ ...headers }; delete .cookie 193.32 ns/op
single-pass copyHeadersOmitting 88.59 ns/op speedup: 2.18x
* perf(appsec): iterate metricsQueue Map directly when applying tags
`rootSpan.addTags(Object.fromEntries(metricsQueue))` materialised a
fresh plain object on every `finishRequest` call only to hand its
entries to `addTags`, which already iterates them.
Bench (Node 24.13 / V8 13.6, n=1 M+ x 7 trials, 4-entry queue):
Object.fromEntries(map) + addTags 213.08 ns/op
setTag per Map entry 37.87 ns/op speedup: 5.63x
…AMES_ENABLED on consumer and push spans (#8125) Makes the GCP Pub/Sub pull-consumer and push-subscription spans honor DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED=true, while preserving the existing observable behavior in v0 default and explicit v1.
`Function.prototype.toString.call(target).startsWith('class')`
materializes the target's full source on every wrap, and `wrapFunction`
runs on multiple instrumentation hot paths.
Class constructors have a non-writable `prototype` descriptor; arrows /
async / method-shorthand have no own `prototype`. The `'prototype' in
target` gate skips the descriptor lookup for the no-prototype shapes;
the `in` operator returns a boolean without materialising the prototype
reference, so it's cheaper than reading `target.prototype`. The check
preserves the existing test that pins behaviour when user code overrides
`target.toString`.
Bench (Node 24.13 / V8 13.6, n=1 M+ x 7 trials, drop best+worst):
toString().startsWith 28.15 ns/op
descriptor lookup unconditional 12.99 ns/op
'prototype' in gate + descriptor 10.29 ns/op
eslint-plugin-sonarjs catches small bugs the existing linters miss. The well-defined rules go on now; the noisier ones stay 'off' with their current violation counts so they can be enabled in follow-ups. A handful of fixtures opt out of specific rules via inline disable because the flagged shape is the test's surface: `no-unused-collection` on the OOM profiler's heap anchor and the debugger snapshot's target-code collections; `no-all-duplicated-branches` on the EFD jest snapshot fixtures whose retry-dependent branches the EFD spec exercises. Two auto-fix corrections are folded in: 1. The LLMObs SDK "uses wrap correctly" integration test reaches into the wrap via `arguments`, not a named parameter. `no-extra-arguments` had cascaded the empty signature back to the entry call and dropped the workflow span's `inputValue`. Restore the call site and disable the rule on the single `workflow(input)` line. 2. `max-collection-size` debugger fixture's `eslint-disable` block moves inline onto `function run ()`. The auto-fix had prepended a 3-line block at file top, shifting every subsequent line down; the debugger spec's hardcoded line-29 breakpoint then sat inside the populating for-loop instead of `return`, fired 499 times, and `npm run test:debugger:ci` hung on the unhandled hits. Drive-by fix: * Deduplicate `yarn.lock`. * Add `@DataDog/apm-sdk-capabilities-js` ownership for `scripts/verify-exercised-tests.js`, matching the other `/scripts/...` entries in that group.
The `DatabasePlugin` base class supports a `truncate` option via its `maybeTruncate()` method, but this was missing from the TypeScript definitions. This adds a `DatabaseInstrumentation` interface with the `truncate` property and updates the plugin interfaces that actually call `maybeTruncate()` (pg and prisma) to extend it. When `truncate` is `true`, resource names are capped at 5000 characters (matching the Datadog agent default). A numeric value overrides the limit. This prevents large queries from blocking the event loop during synchronous trace encoding. Co-authored-by: Tom Quist <tomquist@users.noreply.github.com>
…edding & retrieval input and output (#8299) * user processor supports span kind, scrubbing embedding and retrieval IO * merge span trace parent tags with own tags for user span processor, but not actual span * remove parent tags
Closed
Contributor
Overall package sizeSelf size: 5.78 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.1 | 82.56 kB | 817.39 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
sabrenner
previously approved these changes
May 7, 2026
sabrenner
marked this pull request as ready for review
May 7, 2026 19:07
dd-octo-sts
Bot
force-pushed
the
v5.102.0-proposal
branch
from
May 8, 2026 05:44
0471d9a to
30f7251
Compare
…8333) * build(types): add index.d.v5.ts snapshot and v5-release swap script Master's `index.d.ts` is the v6 type surface from this PR forward; the new `index.d.v5.ts` is a frozen byte-copy of the current (v5) surface that the v5 release line publishes via `scripts/release/swap-v5-types.js`. The swap runs from `scripts/release/proposal.js` only when `releaseLine === '5'` and lands as a separate commit so the version-bump commit stays single-purpose. Public TypeScript declarations now go in both files unless the API is v6-only -- captured in AGENTS.md alongside the existing version-check guidance. * build(types): move v5 swap to prepack and drop test/workflow scaffolding The swap should affect the published v5 tarball and nothing else: not the git history of v5.x, not the proposal PR, not master CI. Wiring it through scripts/release/proposal.js made it a committed change on the proposal branch, which would conflict on the next cherry-pick. prepack runs the swap at npm pack / npm publish time only, on a working tree that gets discarded after publish. The standalone test and its dedicated CI workflow are gone -- the only observable contract is "did npm publish ship the v5 typings", which the published tarball already verifies.
Same shape change applied to instrumentation files starting `[m-z]*`.
* refactor(prefer-rest-params): convert instrumentations d-l Same shape change applied to instrumentation files starting `[d-l]*`. * fix(instrumentations/lodash): keep `arguments` on the channel message The `prefer-rest-params` rewrite renamed the published property from `arguments` to `args`. The IAST taint-tracking handler reads `message.arguments` to forward call args to `TaintedUtils`, so taint propagation broke for every instrumented lodash op and `AppSec / lodash` failed.
Same shape change as the previous PR — `function () { … arguments … }`
becomes `function (...args)` — applied to instrumentation files
starting `[a-c]*`. Microbench in the previous commit confirmed the two
shapes are equivalent on the shimmer hot path; this batch keeps each
PR under the 400-line review budget.
…8353) Replaces `function () { … arguments … }` with `function (...args)` in benchmarks, tests, plugins, and `dd-trace/src` modules outside the instrumentation hot path. Microbench on the canonical shimmer forwarding shape (`fn.apply(this, arguments)` vs `fn.apply(this, args)`) on Node 24.13.0 / V8 13.6 over 7 trials of 5 M iterations each (drop best+worst): arguments 5.87 ns/call, ...args 5.95 ns/call — 0.08 ns delta is inside the 0.2-0.7 ns trial-to-trial noise, so the modern syntax does not cost meaningful perf in modern V8 even on the instrumentation hot path. The instrumentation files (`packages/datadog-instrumentations/src/*`) ship in follow-up PRs to keep each diff under the 400-line review budget. The eslint rule stays off until all 928 hits are migrated; final activation lands when the last file is done.
The remaining hits are CLI scripts, driver/harness fixtures, and debugger target apps where the shebang lets the file run as `./script.js` and `process.exit` is the expected termination signal. The path-glob overrides keep the rules off for those layers so they still challenge accidental shebangs / bare `process.exit` in library code.
Moves test cleanup before `done()` (no-code-after-done), splits nested-loop counters in the IAST handler / debugger snapshot pruner / llmobs unicode encoder out of the outer index (updated-loop-counter), and disables `stable-tests` for the CI-visibility retry fixtures whose `this.retries(N)` is the contract under test. The remaining genuine retries (Playwright chromium, profiler timing, AWS SDK serverless, naming-schema agent flush) keep targeted disables with the actual flake source spelled out.
Activates `sonarjs/no-identical-functions`. Test fixtures whose bodies close over per-`it` state (http2 inline `app` handlers, per-test event/chunk buffers) keep targeted `eslint-disable` lines — the duplication is what makes each test self-contained — so the rule still catches new duplicates outside that pattern.
dd-octo-sts
Bot
force-pushed
the
v5.102.0-proposal
branch
from
May 8, 2026 11:03
30f7251 to
e5d97b0
Compare
BridgeAR
previously approved these changes
May 8, 2026
watson
added a commit
that referenced
this pull request
May 8, 2026
…p functions JSON (#8358) * fix(aws-sdk): inject step functions context for whitespace-suffixed JSON The cheap shape gate added in #8231 rejects payloads serialized with trailing whitespace (`'{"a":1}\n'`), so a caller that pretty-prints the JSON loses distributed-tracing propagation through `startExecution` / `startSyncExecution`. Trim trailing whitespace before the brace check; whitespace-suffixed payloads now fall through to the slow path inside `injectFieldIntoJsonObject`. `String.prototype.trimEnd` returns the input unchanged when no whitespace is present, so the common path allocates nothing. Refs: #8231 Refs: #8339 * fix(encode): skip native span events with a non-string name `Span.addEvent` and the OTel bridge accept any value for `name` without type-checking it; the typed-wrapper encoder added in #8233 then routes `event.name` straight into `Buffer.byteLength` on the first cache miss, which throws on `null` / `Symbol(...)` and aborts the entire trace export. The legacy stringifier already defers non-string names to `JSON.stringify`; the native path lacked the equivalent guard. Drop offending events from the native path so the rest of the trace still exports. Refs: #8233 Refs: #8339 * Apply suggestions from code review Co-authored-by: Thomas Watson <w@tson.dk> --------- Co-authored-by: Thomas Watson <w@tson.dk>
…eInt (#8306) `Number.parseInt(end - start)` forces a `String(bigint)` round-trip through decimal stringify and re-parse before scaling by 1e3 — a slower path than the direct BigInt-to-Number coercion the code intended. No observable behaviour change in the normal value range. Bench (Node 24.13 / V8 13.6, n=1 M+ x 7 trials, drop best+worst): Number.parseInt(bigint) 32.57 ns/op Number(bigint) 10.21 ns/op speedup: 3.19x
Co-authored-by: gh-worker-campaigns-3e9aa4[bot] <244854796+gh-worker-campaigns-3e9aa4[bot]@users.noreply.github.com>
…p functions JSON (#8358) * fix(aws-sdk): inject step functions context for whitespace-suffixed JSON The cheap shape gate added in #8231 rejects payloads serialized with trailing whitespace (`'{"a":1}\n'`), so a caller that pretty-prints the JSON loses distributed-tracing propagation through `startExecution` / `startSyncExecution`. Trim trailing whitespace before the brace check; whitespace-suffixed payloads now fall through to the slow path inside `injectFieldIntoJsonObject`. `String.prototype.trimEnd` returns the input unchanged when no whitespace is present, so the common path allocates nothing. Refs: #8231 Refs: #8339 * fix(encode): skip native span events with a non-string name `Span.addEvent` and the OTel bridge accept any value for `name` without type-checking it; the typed-wrapper encoder added in #8233 then routes `event.name` straight into `Buffer.byteLength` on the first cache miss, which throws on `null` / `Symbol(...)` and aborts the entire trace export. The legacy stringifier already defers non-string names to `JSON.stringify`; the native path lacked the equivalent guard. Drop offending events from the native path so the rest of the trace still exports. Refs: #8233 Refs: #8339 * Apply suggestions from code review Co-authored-by: Thomas Watson <w@tson.dk> --------- Co-authored-by: Thomas Watson <w@tson.dk>
dd-octo-sts
Bot
force-pushed
the
v5.102.0-proposal
branch
from
May 8, 2026 11:51
e5d97b0 to
c13bae4
Compare
BenchmarksBenchmark execution time: 2026-05-08 12:08:08 Comparing candidate commit c13bae4 in PR branch Found 127 performance improvements and 74 performance regressions! Performance is the same for 1543 metrics, 100 unstable metrics. scenario:encoders-0.4-18
scenario:encoders-0.4-20
scenario:encoders-0.4-22
scenario:encoders-0.4-24
scenario:encoders-0.4-events-legacy-18
scenario:encoders-0.4-events-legacy-20
scenario:encoders-0.4-events-legacy-22
scenario:encoders-0.4-events-legacy-24
scenario:encoders-0.4-events-native-18
scenario:encoders-0.4-events-native-20
scenario:encoders-0.4-events-native-22
scenario:encoders-0.4-events-native-24
scenario:encoders-0.5-18
scenario:encoders-0.5-20
scenario:encoders-0.5-22
scenario:encoders-0.5-24
scenario:encoders-0.5-events-legacy-18
scenario:encoders-0.5-events-legacy-20
scenario:encoders-0.5-events-legacy-22
scenario:encoders-0.5-events-legacy-24
scenario:plugin-aws-sdk-eventbridge-inject-detail-18
scenario:plugin-aws-sdk-eventbridge-inject-detail-20
scenario:plugin-aws-sdk-eventbridge-inject-detail-22
scenario:plugin-aws-sdk-eventbridge-inject-detail-24
scenario:plugin-aws-sdk-extract-response-body-18
scenario:plugin-aws-sdk-extract-response-body-20
scenario:plugin-aws-sdk-extract-response-body-22
scenario:plugin-aws-sdk-extract-response-body-24
scenario:plugin-aws-sdk-lambda-inject-no-context-18
scenario:plugin-aws-sdk-lambda-inject-no-context-20
scenario:plugin-graphql-long-control-18
scenario:plugin-graphql-long-control-20
scenario:plugin-graphql-long-control-22
scenario:plugin-graphql-long-control-24
scenario:plugin-graphql-long-with-async-hooks-18
scenario:plugin-graphql-long-with-async-hooks-20
scenario:plugin-graphql-long-with-async-hooks-22
scenario:plugin-graphql-long-with-async-hooks-24
scenario:plugin-graphql-long-with-depth-and-collapse-off-18
scenario:plugin-graphql-long-with-depth-and-collapse-off-20
scenario:plugin-graphql-long-with-depth-and-collapse-off-22
scenario:plugin-graphql-long-with-depth-and-collapse-off-24
scenario:plugin-graphql-long-with-depth-and-collapse-on-18
scenario:plugin-graphql-long-with-depth-and-collapse-on-20
scenario:plugin-graphql-long-with-depth-and-collapse-on-22
scenario:plugin-graphql-long-with-depth-and-collapse-on-24
scenario:plugin-graphql-long-with-depth-off-18
scenario:plugin-graphql-long-with-depth-off-20
scenario:plugin-graphql-long-with-depth-off-22
scenario:plugin-graphql-long-with-depth-off-24
scenario:plugin-graphql-long-with-depth-on-max-18
scenario:plugin-graphql-long-with-depth-on-max-20
scenario:plugin-graphql-long-with-depth-on-max-22
scenario:plugin-graphql-long-with-depth-on-max-24
scenario:shimmer-startup-arrow-wrapfn-18
scenario:shimmer-startup-arrow-wrapfn-20
scenario:shimmer-startup-arrow-wrapfn-22
scenario:shimmer-startup-arrow-wrapfn-24
scenario:shimmer-startup-asyncarrow-wrapfn-18
scenario:shimmer-startup-asyncarrow-wrapfn-20
scenario:shimmer-startup-asyncarrow-wrapfn-22
scenario:shimmer-startup-asyncarrow-wrapfn-24
scenario:shimmer-startup-asyncdeclared-wrapfn-18
scenario:shimmer-startup-asyncdeclared-wrapfn-20
scenario:shimmer-startup-asyncdeclared-wrapfn-22
scenario:shimmer-startup-asyncdeclared-wrapfn-24
|
BridgeAR
approved these changes
May 8, 2026
BridgeAR
enabled auto-merge (rebase)
May 8, 2026 12:54
BridgeAR
added a commit
that referenced
this pull request
May 8, 2026
…p functions JSON (#8358) * fix(aws-sdk): inject step functions context for whitespace-suffixed JSON The cheap shape gate added in #8231 rejects payloads serialized with trailing whitespace (`'{"a":1}\n'`), so a caller that pretty-prints the JSON loses distributed-tracing propagation through `startExecution` / `startSyncExecution`. Trim trailing whitespace before the brace check; whitespace-suffixed payloads now fall through to the slow path inside `injectFieldIntoJsonObject`. `String.prototype.trimEnd` returns the input unchanged when no whitespace is present, so the common path allocates nothing. Refs: #8231 Refs: #8339 * fix(encode): skip native span events with a non-string name `Span.addEvent` and the OTel bridge accept any value for `name` without type-checking it; the typed-wrapper encoder added in #8233 then routes `event.name` straight into `Buffer.byteLength` on the first cache miss, which throws on `null` / `Symbol(...)` and aborts the entire trace export. The legacy stringifier already defers non-string names to `JSON.stringify`; the native path lacked the equivalent guard. Drop offending events from the native path so the rest of the trace still exports. Refs: #8233 Refs: #8339 * Apply suggestions from code review Co-authored-by: Thomas Watson <w@tson.dk> --------- Co-authored-by: Thomas Watson <w@tson.dk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
3daff728b8] - (SEMVER-PATCH) fix: tolerate non-string span event names and whitespace-suffixed step functions JSON (Ruben Bridgewater) #8358130a30caf8] - (SEMVER-PATCH) chore(ci) update one-pipeline (gh-worker-campaigns-3e9aa4[bot]) #83429001878b55] - (SEMVER-PATCH) refactor: dedupe redundant chars in regex character classes (Ruben Bridgewater) #83466c7179306d] - (SEMVER-PATCH) refactor(appsec): convert WAF duration BigInt to Number, not via parseInt (Ruben Bridgewater) #830614a0a822a3] - (SEMVER-PATCH) refactor: dedupe identical function bodies (Ruben Bridgewater) #83470e7a8c7256] - (SEMVER-PATCH) refactor: activate three sonarjs test/loop rules (Ruben Bridgewater) #834980076dd5af] - (SEMVER-PATCH) chore(eslint): activate n/hashbang and n/no-process-exit (Ruben Bridgewater) #835246c61ffdd1] - (SEMVER-PATCH) refactor(prefer-rest-params): convert non-instrumentation wrappers (Ruben Bridgewater) #8353bb4f61acaa] - (SEMVER-PATCH) refactor(prefer-rest-params): convert instrumentations a-c (Ruben Bridgewater)a66a186421] - (SEMVER-PATCH) refactor(prefer-rest-params): convert instrumentations d-l (Ruben Bridgewater) #8355418179b183] - (SEMVER-PATCH) refactor(prefer-rest-params): convert instrumentations m-z (Ruben Bridgewater) #83561afa83174a] - (SEMVER-PATCH) build(types): add index.d.v5.ts snapshot and v5-release swap script (Ruben Bridgewater) #833366d49013dc] - (SEMVER-PATCH) update all slow benchmarks to run less iterations (Roch Devost) #834516c4e16b60] - (SEMVER-PATCH) update llmobs encode unicode mixed benchmarks with less iterations (Roch Devost) #8344035fb236b2] - (SEMVER-PATCH) [test optimization] fix mocha EFD callback test arity (Juan Antonio Fernández de Alba) #83385c7c227eb8] - (SEMVER-MINOR) feat(llmobs): enhance LLM Observability span processor span kind, embedding & retrieval input and output (Sam Brenner) #8299d422180bbc] - (SEMVER-PATCH) [test optimizaton] Use duration buckets for vitest EFD retries (Juan Antonio Fernández de Alba) #82881764a646dc] - (SEMVER-PATCH) fix(index): Add truncate type to database plugin interfaces (Pablo Erhard) #8336ce8a754efa] - (SEMVER-PATCH) chore: add sonar linter (Ruben Bridgewater) #815016016c6b5a] - (SEMVER-PATCH) perf(shimmer): drop assertNotClass toString call (Ruben Bridgewater) #83294c45faa946] - (SEMVER-PATCH) fix(google-cloud-pubsub): honor DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED on consumer and push spans (Crystal Luc-Magloire) #8125771253286d] - (SEMVER-PATCH) perf(appsec): trim per-request allocations in waf and reporter (Ruben Bridgewater) #83262c8447bb13] - (SEMVER-PATCH) test: decouple request specs from nock 13 internals (Ruben Bridgewater) #83058d64c6e392] - (SEMVER-PATCH) [test optimization] Use duration buckets for cucumber EFD retries (Juan Antonio Fernández de Alba) #82878a10090138] - (SEMVER-PATCH) perf(aws-sdk): cache instrumentation handles and dedupe per-call work (Ruben Bridgewater) #82316c0da23ceb] - (SEMVER-PATCH) [test optimization] Use duration buckets for mocha EFD retries (Juan Antonio Fernández de Alba) #8286baeb04586b] - (SEMVER-PATCH) fix(ci): approve pnpm package-manager builds (Juan Antonio Fernández de Alba) #8331a200dc4d96] - (SEMVER-PATCH) chore(iast): Improve stringifyWithRanges performance (Ugaitz Urien) #827119ef5f86f2] - (SEMVER-PATCH) test(jest,vitest): split integration specs into parallel CI jobs via SPEC matrix (Roch Devost) #831197853d2969] - (SEMVER-PATCH) ci: add fail-fast: false to jobs with matrix (Charles de Beauchesne) #83140fdc801f66] - (SEMVER-PATCH) fix(test-optimization): edge cases when computing final_status tag on playwright (Sebastián Kay) #824950aa02547e] - (SEMVER-PATCH) test: reuse azure function process to lower tests run time (Roch Devost) #8102fe9678ab94] - (SEMVER-PATCH) fix(net): restore Socket.emit after the connect handshake (Ruben Bridgewater) #82755168c02d94] - (SEMVER-PATCH) perf(encode): drop the per-span filter Array allocations in the 0.4 e… (Ruben Bridgewater) #82336bf78256b2] - (SEMVER-PATCH) ci(benchmarks): bump microbenchmark splits from 5 to 6 (Fayssal DEFAA) #8283ff0e435df9] - (SEMVER-PATCH) chore(ci): pin all Docker images to SHA digests (Roch Devost) #8298c54290e695] - (SEMVER-PATCH) test(kafkajs): wait for leaders on createTopics to fix DSM flakes (Eric Firth) #8300