Skip to content

perf(trace-utils)!: span pool to reduce alloc churn on the send path - #2382

Open
paullegranddc wants to merge 5 commits into
mainfrom
paullgdc/trace-utils/span_pool_allocs
Open

perf(trace-utils)!: span pool to reduce alloc churn on the send path#2382
paullegranddc wants to merge 5 commits into
mainfrom
paullgdc/trace-utils/span_pool_allocs

Conversation

@paullegranddc

Copy link
Copy Markdown
Collaborator

Motivation

Allocation is expensive, and spans use a lot of small collections (meta, metrics, span links, events...)
Being able to recycle the allocation should be beneficial in term of perf.

This PR adds a span pool to the trace exporter to do this

Changes

  • Add SpanPool trace utils

    • Backed by a bounded crossbeam_channel so the pool never grows without limit.
    • PooledChunks wraps a Vec<Vec> and returns its spans to a SpanPool on drop. PooledChunks::unpooled() is a zero-overhead wrapper for callers that do not use the pool
  • Add PooledChunks through the send path in libdd-data-pipeline:

    • TraceExporter::send_trace_chunks / send_trace_chunks_async now take PooledChunks<'_, T> instead of Vec<Vec<Span>>
    • Internal dispatch functions (send_agentless_traces_inner, send_otlp_traces_inner, prepare_traces_payload, serialize_payload) now take &[Vec<Span>] so they borrow the spans without consuming them.
    • The OTLP mapper (map_traces_to_otlp) and the v0.5 converter (convert_trace_chunks_v04_to_v05, from_v04_span) likewise move to borrowed inputs, keeping spans alive for recycling.
    • adds an optional span_pool to DefaultExport that wraps chunks before passing them to the exporter.

# Changes

Pass a PooledChunks argument around to the trace exporter that can contain a reference to the span pool.

Whenever spans get dropped, the chunks will get returned to the passed pool.

Previous use cases that don't want to use the Pool can call PooledChunks::unpooled.

# Motivation

Allocation of collection is one of the most expensive things we perform in the tracer (with allocation of Strings).

Being able to reuse allocated capacity should improve performance (to be benchmarked in actual code).
@paullegranddc
paullegranddc requested review from a team as code owners August 20, 2026 12:13
@paullegranddc
paullegranddc requested review from vpellan and removed request for a team August 20, 2026 12:13
@paullegranddc paullegranddc changed the title Paullgdc/trace utils/span pool allocs perf(trace-utils)!: span pool to reduce alloc churn on the send path Aug 20, 2026
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

📚 Documentation Check Results

⚠️ 3445 documentation warning(s) found

📦 libdd-data-pipeline-ffi - 1395 warning(s)

📦 libdd-data-pipeline - 1284 warning(s)

📦 libdd-trace-utils - 766 warning(s)


Updated: 2026-08-25 11:26:06 UTC | Commit: ae6c4d3 | missing-docs job results

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🔒 Cargo Deny Results

⚠️ 11 issue(s) found, showing only errors (advisories, bans, sources)

📦 libdd-data-pipeline-ffi - 4 error(s)

Show output
error[vulnerability]: Invalid pointer dereference in `fmt::Pointer` impl for `Atomic` and `Shared` when the underlying pointer is invalid
   ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:80:1
   │
80 │ crossbeam-epoch 0.9.18 registry+https://github.com/rust-lang/crates.io-index
   │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected
   │
   ├ ID: RUSTSEC-2026-0204
   ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0204
   ├ Affected versions of `fmt::Display` dereference the underlying pointer. This causes a invalid pointer dereference e.g., when a pointer created with `Atomic::null` or `Shared::null`. `fmt::Debug` impls and pre-0.9 `fmt::Display` impls, which do not dereference pointers, are not affected by this issue.
   ├ Announcement: https://github.com/crossbeam-rs/crossbeam/pull/1276
   ├ Solution: Upgrade to >=0.9.20 (try `cargo update -p crossbeam-epoch`)
   ├ crossbeam-epoch v0.9.18
     └── crossbeam-deque v0.8.5
         └── rayon-core v1.12.1
             └── rayon v1.10.0
                 └── criterion v0.5.1
                     ├── libdd-common v5.2.0
                     │   ├── libdd-capabilities-impl v4.0.0
                     │   │   ├── libdd-data-pipeline v8.0.0
                     │   │   │   └── libdd-data-pipeline-ffi v41.0.0
                     │   │   ├── libdd-data-pipeline-ffi v41.0.0 (*)
                     │   │   ├── libdd-shared-runtime v3.0.0
                     │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   │   │   ├── libdd-data-pipeline-ffi v41.0.0 (*)
                     │   │   │   ├── libdd-dogstatsd-client v5.0.0
                     │   │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   │   │   │   └── libdd-trace-stats v7.0.0
                     │   │   │   │       └── libdd-data-pipeline v8.0.0 (*)
                     │   │   │   ├── libdd-telemetry v7.0.0
                     │   │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   │   │   │   └── libdd-trace-stats v7.0.0 (*)
                     │   │   │   └── libdd-trace-stats v7.0.0 (*)
                     │   │   ├── (dev) libdd-telemetry v7.0.0 (*)
                     │   │   ├── libdd-trace-stats v7.0.0 (*)
                     │   │   └── libdd-trace-utils v10.1.0
                     │   │       ├── libdd-data-pipeline v8.0.0 (*)
                     │   │       ├── (dev) libdd-data-pipeline-ffi v41.0.0 (*)
                     │   │       ├── libdd-trace-obfuscation v6.0.0
                     │   │       │   └── libdd-trace-stats v7.0.0 (*)
                     │   │       ├── libdd-trace-stats v7.0.0 (*)
                     │   │       └── (dev) libdd-trace-utils v10.1.0 (*)
                     │   ├── libdd-common-ffi v41.0.0
                     │   │   └── libdd-data-pipeline-ffi v41.0.0 (*)
                     │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   ├── libdd-dogstatsd-client v5.0.0 (*)
                     │   ├── libdd-shared-runtime v3.0.0 (*)
                     │   ├── libdd-telemetry v7.0.0 (*)
                     │   ├── libdd-trace-obfuscation v6.0.0 (*)
                     │   ├── libdd-trace-stats v7.0.0 (*)
                     │   └── libdd-trace-utils v10.1.0 (*)
                     ├── (dev) libdd-data-pipeline v8.0.0 (*)
                     ├── (dev) libdd-ddsketch v1.1.1
                     │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   ├── libdd-telemetry v7.0.0 (*)
                     │   └── libdd-trace-stats v7.0.0 (*)
                     ├── (dev) libdd-trace-normalization v3.0.1
                     │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   └── libdd-trace-utils v10.1.0 (*)
                     ├── (dev) libdd-trace-obfuscation v6.0.0 (*)
                     ├── (dev) libdd-trace-stats v7.0.0 (*)
                     └── (dev) libdd-trace-utils v10.1.0 (*)

error[vulnerability]: h2 unbounded empty DATA frames
    ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:123:1
    │
123 │ h2 0.4.6 registry+https://github.com/rust-lang/crates.io-index
    │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected
    │
    ├ ID: RUSTSEC-2026-0258
    ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0258
    ├ The h2 crate, used internally by hyper, had a flaw that would accept and queue empty DATA frames without limit.
      If streams were not actively drained, this could lead to unbounded memory usage, or a panic if the length overflows.
      
      Low severity.
      
      Patched in v0.4.16.
    ├ Announcement: https://github.com/hyperium/hyper/security/advisories/GHSA-q83h-524g-xf6h
    ├ Solution: Upgrade to >=0.4.16 (try `cargo update -p h2`)
    ├ h2 v0.4.6
      └── hyper v1.6.0
          ├── httpmock v0.8.0-alpha.1
          │   ├── (dev) libdd-data-pipeline v8.0.0
          │   │   └── libdd-data-pipeline-ffi v41.0.0
          │   ├── (dev) libdd-data-pipeline-ffi v41.0.0 (*)
          │   ├── (dev) libdd-telemetry v7.0.0
          │   │   ├── libdd-data-pipeline v8.0.0 (*)
          │   │   └── libdd-trace-stats v7.0.0
          │   │       └── libdd-data-pipeline v8.0.0 (*)
          │   ├── (dev) libdd-trace-stats v7.0.0 (*)
          │   └── libdd-trace-utils v10.1.0
          │       ├── libdd-data-pipeline v8.0.0 (*)
          │       ├── (dev) libdd-data-pipeline-ffi v41.0.0 (*)
          │       ├── libdd-trace-obfuscation v6.0.0
          │       │   └── libdd-trace-stats v7.0.0 (*)
          │       ├── libdd-trace-stats v7.0.0 (*)
          │       └── (dev) libdd-trace-utils v10.1.0 (*)
          ├── hyper-rustls v0.27.7
          │   └── libdd-common v5.2.0
          │       ├── libdd-capabilities-impl v4.0.0
          │       │   ├── libdd-data-pipeline v8.0.0 (*)
          │       │   ├── libdd-data-pipeline-ffi v41.0.0 (*)
          │       │   ├── libdd-shared-runtime v3.0.0
          │       │   │   ├── libdd-data-pipeline v8.0.0 (*)
          │       │   │   ├── libdd-data-pipeline-ffi v41.0.0 (*)
          │       │   │   ├── libdd-dogstatsd-client v5.0.0
          │       │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
          │       │   │   │   └── libdd-trace-stats v7.0.0 (*)
          │       │   │   ├── libdd-telemetry v7.0.0 (*)
          │       │   │   └── libdd-trace-stats v7.0.0 (*)
          │       │   ├── (dev) libdd-telemetry v7.0.0 (*)
          │       │   ├── libdd-trace-stats v7.0.0 (*)
          │       │   └── libdd-trace-utils v10.1.0 (*)
          │       ├── libdd-common-ffi v41.0.0
          │       │   └── libdd-data-pipeline-ffi v41.0.0 (*)
          │       ├── libdd-data-pipeline v8.0.0 (*)
          │       ├── libdd-dogstatsd-client v5.0.0 (*)
          │       ├── libdd-shared-runtime v3.0.0 (*)
          │       ├── libdd-telemetry v7.0.0 (*)
          │       ├── libdd-trace-obfuscation v6.0.0 (*)
          │       ├── libdd-trace-stats v7.0.0 (*)
          │       └── libdd-trace-utils v10.1.0 (*)
          ├── hyper-util v0.1.17
          │   ├── httpmock v0.8.0-alpha.1 (*)
          │   ├── hyper-rustls v0.27.7 (*)
          │   └── libdd-common v5.2.0 (*)
          ├── libdd-common v5.2.0 (*)
          ├── libdd-common-ffi v41.0.0 (*)
          └── libdd-trace-utils v10.1.0 (*)

error[unsound]: Rand is unsound with a custom logger using `rand::rng()`
    ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:231:1
    │
231 │ rand 0.8.5 registry+https://github.com/rust-lang/crates.io-index
    │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ unsound advisory detected
    │
    ├ ID: RUSTSEC-2026-0097
    ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0097
    ├ It has been reported (by [@lopopolo](https://github.com/lopopolo)) that the `rand` library is [unsound](https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library) (i.e. that safe code using the public API can cause Undefined Behaviour) when all the following conditions are met:
      
      - The `log` and `thread_rng` features are enabled
      - A [custom logger](https://docs.rs/log/latest/log/#implementing-a-logger) is defined
      - The custom logger accesses `rand::rng()` (previously `rand::thread_rng()`) and calls any `TryRng` (previously `RngCore`) methods on `ThreadRng`
      - The `ThreadRng` (attempts to) reseed while called from the custom logger (this happens every 64 kB of generated data)
      - Trace-level logging is enabled or warn-level logging is enabled and the random source (the `getrandom` crate) is unable to provide a new seed
      
      `TryRng` (previously `RngCore`) methods for `ThreadRng` use `unsafe` code to cast `*mut BlockRng<ReseedingCore>` to `&mut BlockRng<ReseedingCore>`. When all the above conditions are met this results in an aliased mutable reference, violating the Stacked Borrows rules. Miri is able to detect this violation in sample code. Since construction of [aliased mutable references is Undefined Behaviour](https://doc.rust-lang.org/stable/nomicon/references.html), the behaviour of optimized builds is hard to predict.
    ├ Announcement: https://github.com/rust-random/rand/pull/1763
    ├ Solution: Upgrade to >=0.10.1 OR <0.10.0, >=0.9.3 OR <0.9.0, >=0.8.6 (try `cargo update -p rand`)
    ├ rand v0.8.5
      ├── libdd-common v5.2.0
      │   ├── libdd-capabilities-impl v4.0.0
      │   │   ├── libdd-data-pipeline v8.0.0
      │   │   │   └── libdd-data-pipeline-ffi v41.0.0
      │   │   ├── libdd-data-pipeline-ffi v41.0.0 (*)
      │   │   ├── libdd-shared-runtime v3.0.0
      │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
      │   │   │   ├── libdd-data-pipeline-ffi v41.0.0 (*)
      │   │   │   ├── libdd-dogstatsd-client v5.0.0
      │   │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
      │   │   │   │   └── libdd-trace-stats v7.0.0
      │   │   │   │       └── libdd-data-pipeline v8.0.0 (*)
      │   │   │   ├── libdd-telemetry v7.0.0
      │   │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
      │   │   │   │   └── libdd-trace-stats v7.0.0 (*)
      │   │   │   └── libdd-trace-stats v7.0.0 (*)
      │   │   ├── (dev) libdd-telemetry v7.0.0 (*)
      │   │   ├── libdd-trace-stats v7.0.0 (*)
      │   │   └── libdd-trace-utils v10.1.0
      │   │       ├── libdd-data-pipeline v8.0.0 (*)
      │   │       ├── (dev) libdd-data-pipeline-ffi v41.0.0 (*)
      │   │       ├── libdd-trace-obfuscation v6.0.0
      │   │       │   └── libdd-trace-stats v7.0.0 (*)
      │   │       ├── libdd-trace-stats v7.0.0 (*)
      │   │       └── (dev) libdd-trace-utils v10.1.0 (*)
      │   ├── libdd-common-ffi v41.0.0
      │   │   └── libdd-data-pipeline-ffi v41.0.0 (*)
      │   ├── libdd-data-pipeline v8.0.0 (*)
      │   ├── libdd-dogstatsd-client v5.0.0 (*)
      │   ├── libdd-shared-runtime v3.0.0 (*)
      │   ├── libdd-telemetry v7.0.0 (*)
      │   ├── libdd-trace-obfuscation v6.0.0 (*)
      │   ├── libdd-trace-stats v7.0.0 (*)
      │   └── libdd-trace-utils v10.1.0 (*)
      ├── (dev) libdd-data-pipeline v8.0.0 (*)
      ├── (dev) libdd-ddsketch v1.1.1
      │   ├── libdd-data-pipeline v8.0.0 (*)
      │   ├── libdd-telemetry v7.0.0 (*)
      │   └── libdd-trace-stats v7.0.0 (*)
      ├── (dev) libdd-trace-normalization v3.0.1
      │   ├── libdd-data-pipeline v8.0.0 (*)
      │   └── libdd-trace-utils v10.1.0 (*)
      ├── (dev) libdd-trace-stats v7.0.0 (*)
      ├── libdd-trace-utils v10.1.0 (*)
      └── proptest v1.5.0
          ├── (dev) libdd-common v5.2.0 (*)
          └── (dev) libdd-tinybytes v1.1.2
              ├── libdd-data-pipeline v8.0.0 (*)
              ├── libdd-data-pipeline-ffi v41.0.0 (*)
              ├── (dev) libdd-tinybytes v1.1.2 (*)
              └── libdd-trace-utils v10.1.0 (*)

error[vulnerability]: Denial of Service via Stack Exhaustion
    ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:304:1
    │
304 │ time 0.3.41 registry+https://github.com/rust-lang/crates.io-index
    │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected
    │
    ├ ID: RUSTSEC-2026-0009
    ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0009
    ├ ## Impact
      
      When user-provided input is provided to any type that parses with the RFC 2822 format, a denial of
      service attack via stack exhaustion is possible. The attack relies on formally deprecated and
      rarely-used features that are part of the RFC 2822 format used in a malicious manner. Ordinary,
      non-malicious input will never encounter this scenario.
      
      ## Patches
      
      A limit to the depth of recursion was added in v0.3.47. From this version, an error will be returned
      rather than exhausting the stack.
      
      ## Workarounds
      
      Limiting the length of user input is the simplest way to avoid stack exhaustion, as the amount of
      the stack consumed would be at most a factor of the length of the input.
    ├ Announcement: https://github.com/time-rs/time/blob/main/CHANGELOG.md#0347-2026-02-05
    ├ Solution: Upgrade to >=0.3.47 (try `cargo update -p time`)
    ├ time v0.3.41
      └── tracing-appender v0.2.3
          └── libdd-log v1.0.0
              └── (dev) libdd-data-pipeline v8.0.0
                  └── libdd-data-pipeline-ffi v41.0.0

advisories FAILED, bans ok, sources ok

📦 libdd-data-pipeline - 4 error(s)

Show output
error[vulnerability]: Invalid pointer dereference in `fmt::Pointer` impl for `Atomic` and `Shared` when the underlying pointer is invalid
   ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:77:1
   │
77 │ crossbeam-epoch 0.9.18 registry+https://github.com/rust-lang/crates.io-index
   │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected
   │
   ├ ID: RUSTSEC-2026-0204
   ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0204
   ├ Affected versions of `fmt::Display` dereference the underlying pointer. This causes a invalid pointer dereference e.g., when a pointer created with `Atomic::null` or `Shared::null`. `fmt::Debug` impls and pre-0.9 `fmt::Display` impls, which do not dereference pointers, are not affected by this issue.
   ├ Announcement: https://github.com/crossbeam-rs/crossbeam/pull/1276
   ├ Solution: Upgrade to >=0.9.20 (try `cargo update -p crossbeam-epoch`)
   ├ crossbeam-epoch v0.9.18
     └── crossbeam-deque v0.8.5
         └── rayon-core v1.12.1
             └── rayon v1.10.0
                 └── criterion v0.5.1
                     ├── libdd-common v5.2.0
                     │   ├── libdd-capabilities-impl v4.0.0
                     │   │   ├── libdd-data-pipeline v8.0.0
                     │   │   ├── libdd-shared-runtime v3.0.0
                     │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   │   │   ├── libdd-dogstatsd-client v5.0.0
                     │   │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   │   │   │   └── libdd-trace-stats v7.0.0
                     │   │   │   │       └── libdd-data-pipeline v8.0.0 (*)
                     │   │   │   ├── libdd-telemetry v7.0.0
                     │   │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   │   │   │   └── libdd-trace-stats v7.0.0 (*)
                     │   │   │   └── libdd-trace-stats v7.0.0 (*)
                     │   │   ├── (dev) libdd-telemetry v7.0.0 (*)
                     │   │   ├── libdd-trace-stats v7.0.0 (*)
                     │   │   └── libdd-trace-utils v10.1.0
                     │   │       ├── libdd-data-pipeline v8.0.0 (*)
                     │   │       ├── libdd-trace-obfuscation v6.0.0
                     │   │       │   └── libdd-trace-stats v7.0.0 (*)
                     │   │       ├── libdd-trace-stats v7.0.0 (*)
                     │   │       └── (dev) libdd-trace-utils v10.1.0 (*)
                     │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   ├── libdd-dogstatsd-client v5.0.0 (*)
                     │   ├── libdd-shared-runtime v3.0.0 (*)
                     │   ├── libdd-telemetry v7.0.0 (*)
                     │   ├── libdd-trace-obfuscation v6.0.0 (*)
                     │   ├── libdd-trace-stats v7.0.0 (*)
                     │   └── libdd-trace-utils v10.1.0 (*)
                     ├── (dev) libdd-data-pipeline v8.0.0 (*)
                     ├── (dev) libdd-ddsketch v1.1.1
                     │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   ├── libdd-telemetry v7.0.0 (*)
                     │   └── libdd-trace-stats v7.0.0 (*)
                     ├── (dev) libdd-trace-normalization v3.0.1
                     │   ├── libdd-data-pipeline v8.0.0 (*)
                     │   └── libdd-trace-utils v10.1.0 (*)
                     ├── (dev) libdd-trace-obfuscation v6.0.0 (*)
                     ├── (dev) libdd-trace-stats v7.0.0 (*)
                     └── (dev) libdd-trace-utils v10.1.0 (*)

error[vulnerability]: h2 unbounded empty DATA frames
    ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:117:1
    │
117 │ h2 0.4.6 registry+https://github.com/rust-lang/crates.io-index
    │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected
    │
    ├ ID: RUSTSEC-2026-0258
    ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0258
    ├ The h2 crate, used internally by hyper, had a flaw that would accept and queue empty DATA frames without limit.
      If streams were not actively drained, this could lead to unbounded memory usage, or a panic if the length overflows.
      
      Low severity.
      
      Patched in v0.4.16.
    ├ Announcement: https://github.com/hyperium/hyper/security/advisories/GHSA-q83h-524g-xf6h
    ├ Solution: Upgrade to >=0.4.16 (try `cargo update -p h2`)
    ├ h2 v0.4.6
      └── hyper v1.6.0
          ├── httpmock v0.8.0-alpha.1
          │   ├── (dev) libdd-data-pipeline v8.0.0
          │   ├── (dev) libdd-telemetry v7.0.0
          │   │   ├── libdd-data-pipeline v8.0.0 (*)
          │   │   └── libdd-trace-stats v7.0.0
          │   │       └── libdd-data-pipeline v8.0.0 (*)
          │   ├── (dev) libdd-trace-stats v7.0.0 (*)
          │   └── libdd-trace-utils v10.1.0
          │       ├── libdd-data-pipeline v8.0.0 (*)
          │       ├── libdd-trace-obfuscation v6.0.0
          │       │   └── libdd-trace-stats v7.0.0 (*)
          │       ├── libdd-trace-stats v7.0.0 (*)
          │       └── (dev) libdd-trace-utils v10.1.0 (*)
          ├── hyper-rustls v0.27.7
          │   └── libdd-common v5.2.0
          │       ├── libdd-capabilities-impl v4.0.0
          │       │   ├── libdd-data-pipeline v8.0.0 (*)
          │       │   ├── libdd-shared-runtime v3.0.0
          │       │   │   ├── libdd-data-pipeline v8.0.0 (*)
          │       │   │   ├── libdd-dogstatsd-client v5.0.0
          │       │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
          │       │   │   │   └── libdd-trace-stats v7.0.0 (*)
          │       │   │   ├── libdd-telemetry v7.0.0 (*)
          │       │   │   └── libdd-trace-stats v7.0.0 (*)
          │       │   ├── (dev) libdd-telemetry v7.0.0 (*)
          │       │   ├── libdd-trace-stats v7.0.0 (*)
          │       │   └── libdd-trace-utils v10.1.0 (*)
          │       ├── libdd-data-pipeline v8.0.0 (*)
          │       ├── libdd-dogstatsd-client v5.0.0 (*)
          │       ├── libdd-shared-runtime v3.0.0 (*)
          │       ├── libdd-telemetry v7.0.0 (*)
          │       ├── libdd-trace-obfuscation v6.0.0 (*)
          │       ├── libdd-trace-stats v7.0.0 (*)
          │       └── libdd-trace-utils v10.1.0 (*)
          ├── hyper-util v0.1.17
          │   ├── httpmock v0.8.0-alpha.1 (*)
          │   ├── hyper-rustls v0.27.7 (*)
          │   └── libdd-common v5.2.0 (*)
          ├── libdd-common v5.2.0 (*)
          └── libdd-trace-utils v10.1.0 (*)

error[unsound]: Rand is unsound with a custom logger using `rand::rng()`
    ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:223:1
    │
223 │ rand 0.8.5 registry+https://github.com/rust-lang/crates.io-index
    │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ unsound advisory detected
    │
    ├ ID: RUSTSEC-2026-0097
    ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0097
    ├ It has been reported (by [@lopopolo](https://github.com/lopopolo)) that the `rand` library is [unsound](https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library) (i.e. that safe code using the public API can cause Undefined Behaviour) when all the following conditions are met:
      
      - The `log` and `thread_rng` features are enabled
      - A [custom logger](https://docs.rs/log/latest/log/#implementing-a-logger) is defined
      - The custom logger accesses `rand::rng()` (previously `rand::thread_rng()`) and calls any `TryRng` (previously `RngCore`) methods on `ThreadRng`
      - The `ThreadRng` (attempts to) reseed while called from the custom logger (this happens every 64 kB of generated data)
      - Trace-level logging is enabled or warn-level logging is enabled and the random source (the `getrandom` crate) is unable to provide a new seed
      
      `TryRng` (previously `RngCore`) methods for `ThreadRng` use `unsafe` code to cast `*mut BlockRng<ReseedingCore>` to `&mut BlockRng<ReseedingCore>`. When all the above conditions are met this results in an aliased mutable reference, violating the Stacked Borrows rules. Miri is able to detect this violation in sample code. Since construction of [aliased mutable references is Undefined Behaviour](https://doc.rust-lang.org/stable/nomicon/references.html), the behaviour of optimized builds is hard to predict.
    ├ Announcement: https://github.com/rust-random/rand/pull/1763
    ├ Solution: Upgrade to >=0.10.1 OR <0.10.0, >=0.9.3 OR <0.9.0, >=0.8.6 (try `cargo update -p rand`)
    ├ rand v0.8.5
      ├── libdd-common v5.2.0
      │   ├── libdd-capabilities-impl v4.0.0
      │   │   ├── libdd-data-pipeline v8.0.0
      │   │   ├── libdd-shared-runtime v3.0.0
      │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
      │   │   │   ├── libdd-dogstatsd-client v5.0.0
      │   │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
      │   │   │   │   └── libdd-trace-stats v7.0.0
      │   │   │   │       └── libdd-data-pipeline v8.0.0 (*)
      │   │   │   ├── libdd-telemetry v7.0.0
      │   │   │   │   ├── libdd-data-pipeline v8.0.0 (*)
      │   │   │   │   └── libdd-trace-stats v7.0.0 (*)
      │   │   │   └── libdd-trace-stats v7.0.0 (*)
      │   │   ├── (dev) libdd-telemetry v7.0.0 (*)
      │   │   ├── libdd-trace-stats v7.0.0 (*)
      │   │   └── libdd-trace-utils v10.1.0
      │   │       ├── libdd-data-pipeline v8.0.0 (*)
      │   │       ├── libdd-trace-obfuscation v6.0.0
      │   │       │   └── libdd-trace-stats v7.0.0 (*)
      │   │       ├── libdd-trace-stats v7.0.0 (*)
      │   │       └── (dev) libdd-trace-utils v10.1.0 (*)
      │   ├── libdd-data-pipeline v8.0.0 (*)
      │   ├── libdd-dogstatsd-client v5.0.0 (*)
      │   ├── libdd-shared-runtime v3.0.0 (*)
      │   ├── libdd-telemetry v7.0.0 (*)
      │   ├── libdd-trace-obfuscation v6.0.0 (*)
      │   ├── libdd-trace-stats v7.0.0 (*)
      │   └── libdd-trace-utils v10.1.0 (*)
      ├── (dev) libdd-data-pipeline v8.0.0 (*)
      ├── (dev) libdd-ddsketch v1.1.1
      │   ├── libdd-data-pipeline v8.0.0 (*)
      │   ├── libdd-telemetry v7.0.0 (*)
      │   └── libdd-trace-stats v7.0.0 (*)
      ├── (dev) libdd-trace-normalization v3.0.1
      │   ├── libdd-data-pipeline v8.0.0 (*)
      │   └── libdd-trace-utils v10.1.0 (*)
      ├── (dev) libdd-trace-stats v7.0.0 (*)
      ├── libdd-trace-utils v10.1.0 (*)
      └── proptest v1.5.0
          ├── (dev) libdd-common v5.2.0 (*)
          └── (dev) libdd-tinybytes v1.1.2
              ├── libdd-data-pipeline v8.0.0 (*)
              ├── (dev) libdd-tinybytes v1.1.2 (*)
              └── libdd-trace-utils v10.1.0 (*)

error[vulnerability]: Denial of Service via Stack Exhaustion
    ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:295:1
    │
295 │ time 0.3.41 registry+https://github.com/rust-lang/crates.io-index
    │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected
    │
    ├ ID: RUSTSEC-2026-0009
    ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0009
    ├ ## Impact
      
      When user-provided input is provided to any type that parses with the RFC 2822 format, a denial of
      service attack via stack exhaustion is possible. The attack relies on formally deprecated and
      rarely-used features that are part of the RFC 2822 format used in a malicious manner. Ordinary,
      non-malicious input will never encounter this scenario.
      
      ## Patches
      
      A limit to the depth of recursion was added in v0.3.47. From this version, an error will be returned
      rather than exhausting the stack.
      
      ## Workarounds
      
      Limiting the length of user input is the simplest way to avoid stack exhaustion, as the amount of
      the stack consumed would be at most a factor of the length of the input.
    ├ Announcement: https://github.com/time-rs/time/blob/main/CHANGELOG.md#0347-2026-02-05
    ├ Solution: Upgrade to >=0.3.47 (try `cargo update -p time`)
    ├ time v0.3.41
      └── tracing-appender v0.2.3
          └── libdd-log v1.0.0
              └── (dev) libdd-data-pipeline v8.0.0

advisories FAILED, bans ok, sources ok

📦 libdd-trace-utils - 3 error(s)

Show output
error[vulnerability]: Invalid pointer dereference in `fmt::Pointer` impl for `Atomic` and `Shared` when the underlying pointer is invalid
   ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:64:1
   │
64 │ crossbeam-epoch 0.9.18 registry+https://github.com/rust-lang/crates.io-index
   │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected
   │
   ├ ID: RUSTSEC-2026-0204
   ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0204
   ├ Affected versions of `fmt::Display` dereference the underlying pointer. This causes a invalid pointer dereference e.g., when a pointer created with `Atomic::null` or `Shared::null`. `fmt::Debug` impls and pre-0.9 `fmt::Display` impls, which do not dereference pointers, are not affected by this issue.
   ├ Announcement: https://github.com/crossbeam-rs/crossbeam/pull/1276
   ├ Solution: Upgrade to >=0.9.20 (try `cargo update -p crossbeam-epoch`)
   ├ crossbeam-epoch v0.9.18
     └── crossbeam-deque v0.8.5
         └── rayon-core v1.12.1
             └── rayon v1.10.0
                 └── criterion v0.5.1
                     ├── libdd-common v5.2.0
                     │   ├── libdd-capabilities-impl v4.0.0
                     │   │   └── libdd-trace-utils v10.1.0
                     │   │       └── (dev) libdd-trace-utils v10.1.0 (*)
                     │   └── libdd-trace-utils v10.1.0 (*)
                     ├── (dev) libdd-trace-normalization v3.0.1
                     │   └── libdd-trace-utils v10.1.0 (*)
                     └── (dev) libdd-trace-utils v10.1.0 (*)

error[vulnerability]: h2 unbounded empty DATA frames
   ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:98:1
   │
98 │ h2 0.4.6 registry+https://github.com/rust-lang/crates.io-index
   │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected
   │
   ├ ID: RUSTSEC-2026-0258
   ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0258
   ├ The h2 crate, used internally by hyper, had a flaw that would accept and queue empty DATA frames without limit.
     If streams were not actively drained, this could lead to unbounded memory usage, or a panic if the length overflows.
     
     Low severity.
     
     Patched in v0.4.16.
   ├ Announcement: https://github.com/hyperium/hyper/security/advisories/GHSA-q83h-524g-xf6h
   ├ Solution: Upgrade to >=0.4.16 (try `cargo update -p h2`)
   ├ h2 v0.4.6
     └── hyper v1.6.0
         ├── httpmock v0.8.0-alpha.1
         │   └── libdd-trace-utils v10.1.0
         │       └── (dev) libdd-trace-utils v10.1.0 (*)
         ├── hyper-rustls v0.27.7
         │   └── libdd-common v5.2.0
         │       ├── libdd-capabilities-impl v4.0.0
         │       │   └── libdd-trace-utils v10.1.0 (*)
         │       └── libdd-trace-utils v10.1.0 (*)
         ├── hyper-util v0.1.17
         │   ├── httpmock v0.8.0-alpha.1 (*)
         │   ├── hyper-rustls v0.27.7 (*)
         │   └── libdd-common v5.2.0 (*)
         ├── libdd-common v5.2.0 (*)
         └── libdd-trace-utils v10.1.0 (*)

error[unsound]: Rand is unsound with a custom logger using `rand::rng()`
    ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:185:1
    │
185 │ rand 0.8.5 registry+https://github.com/rust-lang/crates.io-index
    │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ unsound advisory detected
    │
    ├ ID: RUSTSEC-2026-0097
    ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0097
    ├ It has been reported (by [@lopopolo](https://github.com/lopopolo)) that the `rand` library is [unsound](https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library) (i.e. that safe code using the public API can cause Undefined Behaviour) when all the following conditions are met:
      
      - The `log` and `thread_rng` features are enabled
      - A [custom logger](https://docs.rs/log/latest/log/#implementing-a-logger) is defined
      - The custom logger accesses `rand::rng()` (previously `rand::thread_rng()`) and calls any `TryRng` (previously `RngCore`) methods on `ThreadRng`
      - The `ThreadRng` (attempts to) reseed while called from the custom logger (this happens every 64 kB of generated data)
      - Trace-level logging is enabled or warn-level logging is enabled and the random source (the `getrandom` crate) is unable to provide a new seed
      
      `TryRng` (previously `RngCore`) methods for `ThreadRng` use `unsafe` code to cast `*mut BlockRng<ReseedingCore>` to `&mut BlockRng<ReseedingCore>`. When all the above conditions are met this results in an aliased mutable reference, violating the Stacked Borrows rules. Miri is able to detect this violation in sample code. Since construction of [aliased mutable references is Undefined Behaviour](https://doc.rust-lang.org/stable/nomicon/references.html), the behaviour of optimized builds is hard to predict.
    ├ Announcement: https://github.com/rust-random/rand/pull/1763
    ├ Solution: Upgrade to >=0.10.1 OR <0.10.0, >=0.9.3 OR <0.9.0, >=0.8.6 (try `cargo update -p rand`)
    ├ rand v0.8.5
      ├── (dev) libdd-common v5.2.0
      │   ├── libdd-capabilities-impl v4.0.0
      │   │   └── libdd-trace-utils v10.1.0
      │   │       └── (dev) libdd-trace-utils v10.1.0 (*)
      │   └── libdd-trace-utils v10.1.0 (*)
      ├── (dev) libdd-trace-normalization v3.0.1
      │   └── libdd-trace-utils v10.1.0 (*)
      ├── libdd-trace-utils v10.1.0 (*)
      └── proptest v1.5.0
          ├── (dev) libdd-common v5.2.0 (*)
          └── (dev) libdd-tinybytes v1.1.2
              ├── (dev) libdd-tinybytes v1.1.2 (*)
              └── libdd-trace-utils v10.1.0 (*)

advisories FAILED, bans ok, sources ok

Updated: 2026-08-25 11:27:22 UTC | Commit: ae6c4d3 | dependency-check job results

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 20, 2026

Copy link
Copy Markdown

Tests

All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 90.18%
Overall Coverage: 76.68% (+0.10%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6ff2c62 | Docs | View more details | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 89.59 MB 89.51 MB --.08% (-82.52 KB) 💪
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 8.26 MB 8.20 MB --.75% (-64.02 KB) 💪
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.07 MB 11.06 MB --.05% (-6.31 KB) 💪
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 100.77 MB 100.67 MB --.09% (-99.06 KB) 💪
libdatadog-x64-windows
Artifact Baseline Commit Change
libdatadog-x86-windows
Artifact Baseline Commit Change
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 79.87 MB 79.81 MB --.08% (-66.35 KB) 💪
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 9.17 MB 9.16 MB --.12% (-12.03 KB) 💪
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 95.51 MB 95.47 MB --.04% (-39.55 KB) 💪
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.19 MB 11.17 MB --.12% (-13.96 KB) 💪

@pr-commenter

pr-commenter Bot commented Aug 20, 2026

Copy link
Copy Markdown

Benchmarks

Comparison

Benchmark execution time: 2026-08-24 13:26:26

Comparing candidate commit c3bbbdf in PR branch paullgdc/trace-utils/span_pool_allocs with baseline commit 9d6b2ff in branch main.

Found 9 performance improvements and 12 performance regressions! Performance is the same for 131 metrics, 0 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:profile_add_sample2_frames_x1000

  • 🟩 execution_time [-33.124µs; -30.156µs] or [-4.510%; -4.106%]

scenario:vec_map/as_deduped_map/already_deduped/8

  • 🟩 execution_time [-0.608ns; -0.597ns] or [-4.199%; -4.123%]

scenario:vec_map/dedup/dup_1_in_10/8

  • 🟥 execution_time [+16.321ns; +23.500ns] or [+4.155%; +5.983%]

scenario:vec_map/get_hit/128

  • 🟥 execution_time [+2.706µs; +2.718µs] or [+19.742%; +19.828%]
  • 🟥 throughput [-1545927.836op/s; -1538790.631op/s] or [-16.555%; -16.479%]

scenario:vec_map/get_hit/16

  • 🟥 execution_time [+15.216ns; +15.420ns] or [+6.494%; +6.581%]
  • 🟥 throughput [-4218934.895op/s; -4162155.313op/s] or [-6.178%; -6.095%]

scenario:vec_map/get_hit/64

  • 🟥 execution_time [+537.031ns; +540.447ns] or [+14.206%; +14.297%]
  • 🟥 throughput [-2118743.963op/s; -2105068.394op/s] or [-12.514%; -12.434%]

scenario:vec_map/get_miss/128

  • 🟩 execution_time [-4.303ns; -4.151ns] or [-5.316%; -5.129%]

scenario:vec_map/get_miss/16

  • 🟥 execution_time [+18.089ns; +18.356ns] or [+193.467%; +196.324%]

scenario:vec_map/get_miss/64

  • 🟥 execution_time [+22.069ns; +22.202ns] or [+76.692%; +77.155%]

scenario:vec_map/get_miss/8

  • 🟥 execution_time [+10.842ns; +11.024ns] or [+144.154%; +146.581%]

scenario:vec_map/get_mut/128

  • 🟩 execution_time [-1.764µs; -1.670µs] or [-11.051%; -10.463%]
  • 🟩 throughput [+938401.971op/s; +992962.819op/s] or [+11.700%; +12.380%]

scenario:vec_map/get_mut/16

  • 🟩 execution_time [-31.417ns; -23.210ns] or [-10.741%; -7.935%]
  • 🟩 throughput [+4864010.457op/s; +6769879.557op/s] or [+8.848%; +12.314%]

scenario:vec_map/get_mut/64

  • 🟩 execution_time [-516.234ns; -482.058ns] or [-11.866%; -11.080%]
  • 🟩 throughput [+1841505.251op/s; +1975962.679op/s] or [+12.513%; +13.427%]

scenario:vec_map/insert/16

  • 🟥 execution_time [+20.820ns; +23.319ns] or [+4.883%; +5.469%]
  • 🟥 throughput [-1954782.325op/s; -1744205.931op/s] or [-5.208%; -4.647%]

Benchmark execution time: 2026-08-24 13:33:50

Comparing candidate commit c3bbbdf in PR branch paullgdc/trace-utils/span_pool_allocs with baseline commit 9d6b2ff in branch main.

Found 15 performance improvements and 8 performance regressions! Performance is the same for 145 metrics, 10 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:credit_card/is_card_number/ 3782-8224-6310-005

  • 🟩 execution_time [-5.482µs; -5.350µs] or [-6.875%; -6.710%]
  • 🟩 throughput [+902936.805op/s; +925295.325op/s] or [+7.199%; +7.378%]

scenario:credit_card/is_card_number/ 378282246310005

  • 🟩 execution_time [-5.626µs; -5.540µs] or [-7.660%; -7.542%]
  • 🟩 throughput [+1111694.142op/s; +1127972.742op/s] or [+8.165%; +8.285%]

scenario:credit_card/is_card_number/378282246310005

  • 🟩 execution_time [-5.662µs; -5.531µs] or [-8.062%; -7.875%]
  • 🟩 throughput [+1218844.276op/s; +1245630.572op/s] or [+8.560%; +8.748%]

scenario:credit_card/is_card_number/37828224631000521389798

  • 🟩 execution_time [-7.416µs; -7.360µs] or [-14.168%; -14.061%]
  • 🟩 throughput [+3126617.247op/s; +3153671.049op/s] or [+16.365%; +16.507%]

scenario:credit_card/is_card_number_no_luhn/ 378282246310005

  • 🟩 execution_time [-5.765µs; -5.723µs] or [-9.788%; -9.717%]
  • 🟩 throughput [+1828319.290op/s; +1840709.793op/s] or [+10.769%; +10.842%]

scenario:credit_card/is_card_number_no_luhn/378282246310005

  • 🟩 execution_time [-5.547µs; -5.502µs] or [-9.979%; -9.899%]
  • 🟩 throughput [+1977761.923op/s; +1993265.395op/s] or [+10.993%; +11.079%]

scenario:credit_card/is_card_number_no_luhn/37828224631000521389798

  • 🟩 execution_time [-7.380µs; -7.324µs] or [-14.102%; -13.995%]
  • 🟩 throughput [+3109749.736op/s; +3137132.768op/s] or [+16.275%; +16.418%]

scenario:glob_matcher/ascii_case_insensitive_match/wall_time

  • 🟥 execution_time [+3.548ns; +3.561ns] or [+13.296%; +13.345%]

scenario:glob_matcher/ascii_exact_match/wall_time

  • 🟥 execution_time [+3.551ns; +3.565ns] or [+13.305%; +13.358%]

scenario:glob_matcher/ascii_exact_miss/wall_time

  • 🟥 execution_time [+2.238ns; +2.283ns] or [+19.107%; +19.496%]

scenario:glob_matcher/unicode_exact_match/wall_time

  • 🟥 execution_time [+4.789ns; +4.871ns] or [+6.509%; +6.621%]

scenario:glob_matcher/unicode_pattern_ascii_subject/wall_time

  • 🟩 execution_time [-7.189ns; -7.051ns] or [-7.367%; -7.226%]

scenario:glob_matcher/unicode_pattern_wildcard_match/wall_time

  • 🟥 execution_time [+6.069ns; +6.241ns] or [+4.856%; +4.995%]

scenario:profiler_attached/fast_path_system/4096

  • 🟥 execution_time [+6.421ns; +6.600ns] or [+6.579%; +6.763%]

scenario:trace_buffer/2_senders/no_delay

  • 🟥 execution_time [+99.768µs; +115.256µs] or [+5.885%; +6.799%]
  • 🟥 throughput [-68088.880op/s; -58874.997op/s] or [-6.409%; -5.542%]

Candidate

Omitted due to size.

Baseline

Omitted due to size.

@ekump ekump left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only real concern is the potential flaky test, otherwise LGTM

return Ok(AgentResponse::Unchanged);
}
return self.send_otlp_traces_inner(traces, config).await;
// The OTLP mapper transforms spans into a different representation and consumes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment is accurate?

Suggested change
// The OTLP mapper transforms spans into a different representation and consumes
// The OTLP mapper borrows the spans and builds a separate OTLP
// representation, the original spans are recycled to the pool when `traces` drops.

/// if span usage spikes, and then goes down.
fn drop_policy() -> bool {
const PCT_OF_SPANS_RETURNED_DROPPED: f64 = 0.1;
rand::thread_rng().gen_bool(PCT_OF_SPANS_RETURNED_DROPPED)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to get called on every span being flushed, right? Isn't thread_rng() going to be expensive? Could you do it at the chunk level instead? Or, does it have to be random at all? Could you just drop every X spans deterministically in order to shrink the pool?

mut traces: Vec<Vec<Span<T>>>,
mut traces: PooledChunks<'_, T>,
) -> Result<AgentResponse, TraceExporterError> {
// `traces` is a `PooledChunks`: keeping it owned (rather than moving its inner `Vec`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the right place, but should we document somewhere that only sampled spans make it to the pool?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I guess you note it here.

Comment on lines 226 to 227
// Serialize span links / span events before `span` is consumed below. v0.5 has no
// dedicated slots for them, so they are flattened into `meta` as JSON strings.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment is stale now, span isn't consumed anymore.

fn returned_spans_are_recycled_and_reset() {
let pool = SpanPool::<crate::span::BytesData>::new(100);
{
// No drop policy control here, but with a single span it is very likely retained.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"very likely" is another way of saying flaky.

What is this test actually covering? won't s.name be the same whether it comes from the pool or is a new span?

Should we have a DropPolicy that's injectable? Something like...

  #[derive(Debug)]                                                                                                                                                                                                                                                                       
  enum DropPolicy {                                                                                                                                                                                                                                                                      
      Random(f64),                                                                                                                                                                                                                           
      EveryN { n: usize, counter: AtomicUsize },     // deterministic, no global                                                                                                                                                                                                         
      Never,                                         // tests only?                                                                                                                                                                                                                            
  }                                                                                                                                                                                                                                                                                      
  impl DropPolicy {                                                                                                                                                                                                                                                                      
      fn should_drop(&self) -> bool {                                                                                                                                                                                                                                                    
          match self {                                                                                                                                                                                                                                                                   
              DropPolicy::Random(p) => rand::thread_rng().gen_bool(*p),                                                                                                                                                                                                                  
              DropPolicy::EveryN { n, counter } =>                                                                                                                                                                                                                                       
                  counter.fetch_add(1, Ordering::Relaxed) % n == 0,                                                                                                                                                                                                                      
              DropPolicy::Never => false,                                                                                                                                                                                                                                                
          }                                                                                                                                                                                                                                                                              
      }                                                                                                                                                                                                                                                                                  
  }                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                         
  #[derive(Debug, Clone)]                                                                                                                                                                                                                                                                
  pub struct SpanPool<T: TraceData> {                                                                                                                                                                                                                                                    
      queue: crossbeam_channel::Sender<Span<T>>,                                                                                                                                                                                                                                         
      receiver: crossbeam_channel::Receiver<Span<T>>,                                                                                                                                                                                                                                    
      drop_policy: Arc<DropPolicy>,                                                                                                                                                                                                              
  }  

@ekump

ekump commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Should we have benchmark tests too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants