Repository navigation
v5.101.1 proposal - #8312
Closed
dd-octo-sts[bot] wants to merge 7 commits into
Closed
v5.101.1 proposal#8312dd-octo-sts[bot] wants to merge 7 commits into
dd-octo-sts[bot] wants to merge 7 commits into
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>
Contributor
Overall package sizeSelf size: 5.76 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 |
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 9e6bd47 | Docs | Datadog PR Page | Give us feedback! |
Contributor
Author
|
Superseded by #8339. |
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.
50aa02547e] - (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