Skip to content

feat(shared-runtime): add block_on_with_timeout to BlockingRuntime - #2333

Open
brettlangdon wants to merge 1 commit into
mainfrom
brettlangdon/block_on_timeout
Open

feat(shared-runtime): add block_on_with_timeout to BlockingRuntime#2333
brettlangdon wants to merge 1 commit into
mainfrom
brettlangdon/block_on_timeout

Conversation

@brettlangdon

Copy link
Copy Markdown
Member

What does this PR do?

Lets consumers bound a block_on wait with a deadline without adding tokio as a direct dependency — the executor is whatever the runtime already runs on.

Returns BlockOnTimeoutError::TimedOut/Io to distinguish a timeout from an executor failure.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

How to test the change?

Describe here in detail how the change can be validated.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📚 Documentation Check Results

⚠️ 213 documentation warning(s) found

📦 libdd-shared-runtime - 213 warning(s)


Updated: 2026-08-07 16:03:00 UTC | Commit: 5039b68 | missing-docs job results

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🔒 Cargo Deny Results

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

📦 libdd-shared-runtime - 1 error(s)

Show output
error[unsound]: Rand is unsound with a custom logger using `rand::rng()`
   ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:72:1
   │
72 │ 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.1.0
         ├── libdd-capabilities-impl v3.0.0
         │   └── libdd-shared-runtime v2.0.0
         └── libdd-shared-runtime v2.0.0 (*)

advisories FAILED, bans ok, sources ok

Updated: 2026-08-07 16:04:30 UTC | Commit: 5039b68 | dependency-check job results

@pr-commenter

pr-commenter Bot commented Aug 7, 2026

Copy link
Copy Markdown

Benchmarks

Comparison

Benchmark execution time: 2026-08-07 22:26:01

Comparing candidate commit 0f4a0ae in PR branch brettlangdon/block_on_timeout with baseline commit fbdace3 in branch main.

Found 2 performance improvements and 0 performance regressions! Performance is the same for 23 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:trace_buffer/4_senders/no_delay

  • 🟩 execution_time [-279.136µs; -243.058µs] or [-11.275%; -9.818%]
  • 🟩 throughput [+162093.122op/s; +187705.075op/s] or [+11.140%; +12.901%]

Benchmark execution time: 2026-08-07 22:23:56

Comparing candidate commit 0f4a0ae in PR branch brettlangdon/block_on_timeout with baseline commit fbdace3 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 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 ----------------------------------'

Candidate

Candidate benchmark details

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 0f4a0ae 1786118305 brettlangdon/block_on_timeout
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
trace_buffer/1_senders/10us_delay execution_time 56.344ms 56.647ms ± 0.151ms 56.643ms ± 0.103ms 56.743ms 56.913ms 57.055ms 57.148ms 0.89% 0.448 0.135 0.27% 0.011ms 1 200
trace_buffer/1_senders/10us_delay throughput 15748.637op/s 15888.116op/s ± 42.293op/s 15889.016op/s ± 28.847op/s 15919.364op/s 15953.790op/s 15971.472op/s 15973.277op/s 0.53% -0.433 0.109 0.27% 2.991op/s 1 200
trace_buffer/1_senders/1us_delay execution_time 49.923ms 50.080ms ± 0.031ms 50.078ms ± 0.011ms 50.089ms 50.137ms 50.167ms 50.249ms 0.34% 0.670 7.065 0.06% 0.002ms 1 200
trace_buffer/1_senders/1us_delay throughput 17910.917op/s 17971.147op/s ± 11.143op/s 17971.814op/s ± 4.055op/s 17976.036op/s 17987.133op/s 17990.661op/s 18027.643op/s 0.31% -0.654 7.056 0.06% 0.788op/s 1 200
trace_buffer/1_senders/no_delay execution_time 329.364µs 339.569µs ± 3.753µs 338.622µs ± 1.365µs 340.374µs 346.063µs 352.752µs 365.825µs 8.03% 2.844 13.891 1.10% 0.265µs 1 200
trace_buffer/1_senders/no_delay throughput 2460195.474op/s 2650733.009op/s ± 28445.733op/s 2657831.271op/s ± 10749.832op/s 2666800.843op/s 2677817.837op/s 2682115.736op/s 2732537.586op/s 2.81% -2.600 11.938 1.07% 2011.417op/s 1 200
trace_buffer/2_senders/10us_delay execution_time 56.981ms 57.373ms ± 0.135ms 57.368ms ± 0.090ms 57.469ms 57.597ms 57.668ms 57.748ms 0.66% -0.081 -0.032 0.23% 0.010ms 1 200
trace_buffer/2_senders/10us_delay throughput 31170.084op/s 31373.627op/s ± 73.838op/s 31376.297op/s ± 48.969op/s 31419.834op/s 31490.965op/s 31551.210op/s 31589.738op/s 0.68% 0.095 -0.025 0.23% 5.221op/s 1 200
trace_buffer/2_senders/1us_delay execution_time 50.025ms 50.122ms ± 0.042ms 50.112ms ± 0.021ms 50.139ms 50.202ms 50.232ms 50.278ms 0.33% 1.034 0.884 0.08% 0.003ms 1 200
trace_buffer/2_senders/1us_delay throughput 35801.072op/s 35912.271op/s ± 30.060op/s 35919.656op/s ± 15.315op/s 35933.660op/s 35946.606op/s 35957.856op/s 35982.210op/s 0.17% -1.030 0.873 0.08% 2.126op/s 1 200
trace_buffer/2_senders/no_delay execution_time 840.347µs 892.704µs ± 19.309µs 891.587µs ± 13.452µs 906.990µs 924.580µs 929.355µs 936.870µs 5.08% -0.053 -0.359 2.16% 1.365µs 1 200
trace_buffer/2_senders/no_delay throughput 1921290.994op/s 2017286.462op/s ± 43734.282op/s 2018871.471op/s ± 30007.447op/s 2046711.406op/s 2083826.836op/s 2124794.918op/s 2141972.729op/s 6.10% 0.161 -0.259 2.16% 3092.481op/s 1 200
trace_buffer/4_senders/10us_delay execution_time 57.341ms 57.601ms ± 0.116ms 57.576ms ± 0.060ms 57.651ms 57.818ms 57.997ms 58.016ms 0.76% 1.235 2.148 0.20% 0.008ms 1 200
trace_buffer/4_senders/10us_delay throughput 62051.745op/s 62498.725op/s ± 125.847op/s 62526.411op/s ± 65.200op/s 62578.434op/s 62665.255op/s 62707.861op/s 62781.805op/s 0.41% -1.219 2.103 0.20% 8.899op/s 1 200
trace_buffer/4_senders/1us_delay execution_time 50.096ms 50.164ms ± 0.035ms 50.156ms ± 0.018ms 50.178ms 50.240ms 50.271ms 50.287ms 0.26% 1.125 1.267 0.07% 0.002ms 1 200
trace_buffer/4_senders/1us_delay throughput 71589.534op/s 71765.173op/s ± 49.478op/s 71775.654op/s ± 25.726op/s 71797.940op/s 71826.606op/s 71842.410op/s 71862.064op/s 0.12% -1.120 1.256 0.07% 3.499op/s 1 200
trace_buffer/4_senders/no_delay execution_time 1.887ms 2.215ms ± 0.115ms 2.216ms ± 0.085ms 2.294ms 2.395ms 2.487ms 2.493ms 12.49% 0.019 -0.306 5.17% 0.008ms 1 200
trace_buffer/4_senders/no_delay throughput 1444180.831op/s 1629894.844op/s ± 84933.850op/s 1624630.104op/s ± 61425.538op/s 1691004.313op/s 1776754.801op/s 1806561.631op/s 1907530.347op/s 17.41% 0.249 -0.160 5.20% 6005.730op/s 1 200
trace_buffer/8_senders/10us_delay execution_time 57.628ms 57.923ms ± 0.228ms 57.828ms ± 0.103ms 58.079ms 58.416ms 58.556ms 58.615ms 1.36% 1.150 0.359 0.39% 0.016ms 1 200
trace_buffer/8_senders/10us_delay throughput 122836.418op/s 124305.459op/s ± 486.894op/s 124506.670op/s ± 222.049op/s 124656.934op/s 124787.689op/s 124858.742op/s 124939.558op/s 0.35% -1.138 0.323 0.39% 34.429op/s 1 200
trace_buffer/8_senders/1us_delay execution_time 50.175ms 50.286ms ± 0.052ms 50.272ms ± 0.026ms 50.311ms 50.390ms 50.433ms 50.479ms 0.41% 1.114 1.175 0.10% 0.004ms 1 200
trace_buffer/8_senders/1us_delay throughput 142634.144op/s 143181.679op/s ± 148.091op/s 143222.115op/s ± 73.155op/s 143276.032op/s 143346.141op/s 143445.825op/s 143498.061op/s 0.19% -1.108 1.160 0.10% 10.472op/s 1 200
trace_buffer/8_senders/no_delay execution_time 5.424ms 6.487ms ± 0.244ms 6.562ms ± 0.107ms 6.655ms 6.728ms 6.757ms 6.808ms 3.75% -1.688 2.921 3.75% 0.017ms 1 200
trace_buffer/8_senders/no_delay throughput 1057568.548op/s 1111652.503op/s ± 44803.886op/s 1097204.584op/s ± 17654.755op/s 1126591.075op/s 1222277.374op/s 1266843.421op/s 1327376.608op/s 20.98% 1.948 4.217 4.02% 3168.113op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
trace_buffer/1_senders/10us_delay execution_time [56.626ms; 56.667ms] or [-0.037%; +0.037%] None None None
trace_buffer/1_senders/10us_delay throughput [15882.254op/s; 15893.977op/s] or [-0.037%; +0.037%] None None None
trace_buffer/1_senders/1us_delay execution_time [50.076ms; 50.085ms] or [-0.009%; +0.009%] None None None
trace_buffer/1_senders/1us_delay throughput [17969.602op/s; 17972.691op/s] or [-0.009%; +0.009%] None None None
trace_buffer/1_senders/no_delay execution_time [339.049µs; 340.089µs] or [-0.153%; +0.153%] None None None
trace_buffer/1_senders/no_delay throughput [2646790.704op/s; 2654675.314op/s] or [-0.149%; +0.149%] None None None
trace_buffer/2_senders/10us_delay execution_time [57.355ms; 57.392ms] or [-0.033%; +0.033%] None None None
trace_buffer/2_senders/10us_delay throughput [31363.394op/s; 31383.860op/s] or [-0.033%; +0.033%] None None None
trace_buffer/2_senders/1us_delay execution_time [50.116ms; 50.128ms] or [-0.012%; +0.012%] None None None
trace_buffer/2_senders/1us_delay throughput [35908.105op/s; 35916.437op/s] or [-0.012%; +0.012%] None None None
trace_buffer/2_senders/no_delay execution_time [890.028µs; 895.380µs] or [-0.300%; +0.300%] None None None
trace_buffer/2_senders/no_delay throughput [2011225.311op/s; 2023347.613op/s] or [-0.300%; +0.300%] None None None
trace_buffer/4_senders/10us_delay execution_time [57.585ms; 57.618ms] or [-0.028%; +0.028%] None None None
trace_buffer/4_senders/10us_delay throughput [62481.283op/s; 62516.166op/s] or [-0.028%; +0.028%] None None None
trace_buffer/4_senders/1us_delay execution_time [50.159ms; 50.168ms] or [-0.010%; +0.010%] None None None
trace_buffer/4_senders/1us_delay throughput [71758.316op/s; 71772.031op/s] or [-0.010%; +0.010%] None None None
trace_buffer/4_senders/no_delay execution_time [2.199ms; 2.231ms] or [-0.718%; +0.718%] None None None
trace_buffer/4_senders/no_delay throughput [1618123.829op/s; 1641665.859op/s] or [-0.722%; +0.722%] None None None
trace_buffer/8_senders/10us_delay execution_time [57.891ms; 57.954ms] or [-0.055%; +0.055%] None None None
trace_buffer/8_senders/10us_delay throughput [124237.980op/s; 124372.938op/s] or [-0.054%; +0.054%] None None None
trace_buffer/8_senders/1us_delay execution_time [50.279ms; 50.293ms] or [-0.014%; +0.014%] None None None
trace_buffer/8_senders/1us_delay throughput [143161.155op/s; 143202.203op/s] or [-0.014%; +0.014%] None None None
trace_buffer/8_senders/no_delay execution_time [6.453ms; 6.520ms] or [-0.521%; +0.521%] None None None
trace_buffer/8_senders/no_delay throughput [1105443.116op/s; 1117861.891op/s] or [-0.559%; +0.559%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 0f4a0ae 1786118305 brettlangdon/block_on_timeout
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
concentrator/add_spans_to_concentrator execution_time 9.546ms 9.572ms ± 0.016ms 9.568ms ± 0.010ms 9.582ms 9.605ms 9.618ms 9.634ms 0.69% 1.047 0.954 0.17% 0.001ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
concentrator/add_spans_to_concentrator execution_time [9.570ms; 9.575ms] or [-0.023%; +0.023%] None None None

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz 0f4a0ae 1786118305 brettlangdon/block_on_timeout
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
two way interface execution_time 20.873µs 21.705µs ± 0.356µs 21.637µs ± 0.152µs 21.812µs 22.416µs 22.688µs 23.430µs 8.29% 1.553 4.203 1.64% 0.025µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
two way interface execution_time [21.656µs; 21.755µs] or [-0.227%; +0.227%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz 0f4a0ae 1786118305 brettlangdon/block_on_timeout
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
write only interface execution_time 2.059µs 2.076µs ± 0.008µs 2.075µs ± 0.003µs 2.079µs 2.095µs 2.101µs 2.106µs 1.51% 1.095 1.666 0.40% 0.001µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
write only interface execution_time [2.075µs; 2.077µs] or [-0.056%; +0.056%] None None None

Group 3

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz 0f4a0ae 1786118305 brettlangdon/block_on_timeout
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
receiver_entry_point/report/2644 execution_time 5.234ms 5.352ms ± 0.101ms 5.286ms ± 0.031ms 5.464ms 5.499ms 5.516ms 5.522ms 4.46% 0.435 -1.660 1.88% 0.007ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
receiver_entry_point/report/2644 execution_time [5.338ms; 5.366ms] or [-0.261%; +0.261%] None None None

Baseline

Baseline benchmark details

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz fbdace3 1786121056 main
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
trace_buffer/1_senders/10us_delay execution_time 56.349ms 56.614ms ± 0.154ms 56.589ms ± 0.085ms 56.678ms 56.870ms 57.189ms 57.223ms 1.12% 1.286 2.570 0.27% 0.011ms 1 200
trace_buffer/1_senders/10us_delay throughput 15728.034op/s 15897.201op/s ± 42.978op/s 15904.015op/s ± 23.906op/s 15924.720op/s 15953.679op/s 15970.989op/s 15971.843op/s 0.43% -1.263 2.481 0.27% 3.039op/s 1 200
trace_buffer/1_senders/1us_delay execution_time 49.926ms 50.072ms ± 0.032ms 50.077ms ± 0.013ms 50.085ms 50.134ms 50.172ms 50.198ms 0.24% 0.199 3.368 0.06% 0.002ms 1 200
trace_buffer/1_senders/1us_delay throughput 17929.102op/s 17974.175op/s ± 11.595op/s 17972.472op/s ± 4.708op/s 17981.050op/s 17989.796op/s 17992.047op/s 18026.521op/s 0.30% -0.189 3.373 0.06% 0.820op/s 1 200
trace_buffer/1_senders/no_delay execution_time 329.786µs 337.730µs ± 3.952µs 337.360µs ± 1.334µs 338.743µs 341.805µs 346.678µs 380.245µs 12.71% 6.363 65.564 1.17% 0.279µs 1 200
trace_buffer/1_senders/no_delay throughput 2366894.230op/s 2665186.324op/s ± 29173.669op/s 2667775.634op/s ± 10522.355op/s 2677439.228op/s 2696282.635op/s 2715312.540op/s 2729045.865op/s 2.30% -5.473 53.346 1.09% 2062.890op/s 1 200
trace_buffer/2_senders/10us_delay execution_time 56.687ms 57.113ms ± 0.178ms 57.106ms ± 0.117ms 57.225ms 57.409ms 57.546ms 57.811ms 1.24% 0.268 0.606 0.31% 0.013ms 1 200
trace_buffer/2_senders/10us_delay throughput 31135.964op/s 31516.740op/s ± 98.069op/s 31520.550op/s ± 64.470op/s 31580.572op/s 31675.155op/s 31730.663op/s 31753.362op/s 0.74% -0.244 0.563 0.31% 6.935op/s 1 200
trace_buffer/2_senders/1us_delay execution_time 50.027ms 50.113ms ± 0.037ms 50.107ms ± 0.021ms 50.129ms 50.192ms 50.219ms 50.253ms 0.29% 1.134 1.499 0.07% 0.003ms 1 200
trace_buffer/2_senders/1us_delay throughput 35818.915op/s 35918.901op/s ± 26.165op/s 35923.482op/s ± 15.099op/s 35937.152op/s 35949.352op/s 35958.540op/s 35980.378op/s 0.16% -1.130 1.486 0.07% 1.850op/s 1 200
trace_buffer/2_senders/no_delay execution_time 852.351µs 901.288µs ± 19.266µs 901.535µs ± 12.700µs 913.431µs 931.191µs 944.852µs 980.572µs 8.77% 0.130 0.755 2.13% 1.362µs 1 200
trace_buffer/2_senders/no_delay throughput 1835662.675op/s 1998049.523op/s ± 42669.434op/s 1996594.289op/s ± 27930.463op/s 2026781.788op/s 2065605.083op/s 2110016.028op/s 2111806.704op/s 5.77% 0.037 0.496 2.13% 3017.185op/s 1 200
trace_buffer/4_senders/10us_delay execution_time 57.221ms 57.572ms ± 0.172ms 57.547ms ± 0.070ms 57.618ms 57.873ms 58.009ms 58.961ms 2.46% 3.113 20.572 0.30% 0.012ms 1 200
trace_buffer/4_senders/10us_delay throughput 61057.490op/s 62530.907op/s ± 184.668op/s 62558.004op/s ± 76.026op/s 62632.013op/s 62748.242op/s 62802.809op/s 62913.820op/s 0.57% -3.000 19.395 0.29% 13.058op/s 1 200
trace_buffer/4_senders/1us_delay execution_time 50.112ms 50.171ms ± 0.037ms 50.162ms ± 0.017ms 50.181ms 50.254ms 50.294ms 50.334ms 0.34% 1.697 3.363 0.07% 0.003ms 1 200
trace_buffer/4_senders/1us_delay throughput 71522.673op/s 71755.153op/s ± 53.355op/s 71767.007op/s ± 24.160op/s 71790.687op/s 71813.127op/s 71825.085op/s 71838.660op/s 0.10% -1.691 3.340 0.07% 3.773op/s 1 200
trace_buffer/4_senders/no_delay execution_time 2.328ms 2.476ms ± 0.061ms 2.480ms ± 0.046ms 2.523ms 2.567ms 2.586ms 2.590ms 4.42% -0.247 -0.711 2.48% 0.004ms 1 200
trace_buffer/4_senders/no_delay throughput 1390024.873op/s 1454995.745op/s ± 36390.954op/s 1451519.649op/s ± 26936.888op/s 1480755.382op/s 1518759.082op/s 1536313.453op/s 1546399.249op/s 6.54% 0.340 -0.634 2.49% 2573.229op/s 1 200
trace_buffer/8_senders/10us_delay execution_time 57.587ms 57.887ms ± 0.226ms 57.813ms ± 0.121ms 58.008ms 58.383ms 58.483ms 58.805ms 1.72% 1.253 1.275 0.39% 0.016ms 1 200
trace_buffer/8_senders/10us_delay throughput 122437.714op/s 124382.114op/s ± 483.842op/s 124538.394op/s ± 261.165op/s 124734.641op/s 124898.697op/s 124995.752op/s 125028.214op/s 0.39% -1.233 1.198 0.39% 34.213op/s 1 200
trace_buffer/8_senders/1us_delay execution_time 50.131ms 50.278ms ± 0.052ms 50.266ms ± 0.027ms 50.298ms 50.381ms 50.436ms 50.536ms 0.54% 1.461 3.576 0.10% 0.004ms 1 200
trace_buffer/8_senders/1us_delay throughput 142472.549op/s 143204.264op/s ± 148.398op/s 143237.810op/s ± 76.234op/s 143299.504op/s 143364.341op/s 143399.866op/s 143624.230op/s 0.27% -1.450 3.531 0.10% 10.493op/s 1 200
trace_buffer/8_senders/no_delay execution_time 5.798ms 6.502ms ± 0.192ms 6.541ms ± 0.109ms 6.637ms 6.729ms 6.786ms 6.804ms 4.03% -1.267 1.711 2.95% 0.014ms 1 200
trace_buffer/8_senders/no_delay throughput 1058183.588op/s 1108416.007op/s ± 34136.177op/s 1100798.178op/s ± 18291.064op/s 1122234.135op/s 1169859.282op/s 1225818.230op/s 1241725.709op/s 12.80% 1.465 2.431 3.07% 2413.792op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
trace_buffer/1_senders/10us_delay execution_time [56.593ms; 56.635ms] or [-0.038%; +0.038%] None None None
trace_buffer/1_senders/10us_delay throughput [15891.245op/s; 15903.157op/s] or [-0.037%; +0.037%] None None None
trace_buffer/1_senders/1us_delay execution_time [50.067ms; 50.076ms] or [-0.009%; +0.009%] None None None
trace_buffer/1_senders/1us_delay throughput [17972.568op/s; 17975.782op/s] or [-0.009%; +0.009%] None None None
trace_buffer/1_senders/no_delay execution_time [337.183µs; 338.278µs] or [-0.162%; +0.162%] None None None
trace_buffer/1_senders/no_delay throughput [2661143.134op/s; 2669229.514op/s] or [-0.152%; +0.152%] None None None
trace_buffer/2_senders/10us_delay execution_time [57.088ms; 57.138ms] or [-0.043%; +0.043%] None None None
trace_buffer/2_senders/10us_delay throughput [31503.148op/s; 31530.331op/s] or [-0.043%; +0.043%] None None None
trace_buffer/2_senders/1us_delay execution_time [50.108ms; 50.118ms] or [-0.010%; +0.010%] None None None
trace_buffer/2_senders/1us_delay throughput [35915.275op/s; 35922.527op/s] or [-0.010%; +0.010%] None None None
trace_buffer/2_senders/no_delay execution_time [898.618µs; 903.958µs] or [-0.296%; +0.296%] None None None
trace_buffer/2_senders/no_delay throughput [1992135.950op/s; 2003963.097op/s] or [-0.296%; +0.296%] None None None
trace_buffer/4_senders/10us_delay execution_time [57.548ms; 57.596ms] or [-0.041%; +0.041%] None None None
trace_buffer/4_senders/10us_delay throughput [62505.314op/s; 62556.500op/s] or [-0.041%; +0.041%] None None None
trace_buffer/4_senders/1us_delay execution_time [50.165ms; 50.176ms] or [-0.010%; +0.010%] None None None
trace_buffer/4_senders/1us_delay throughput [71747.758op/s; 71762.547op/s] or [-0.010%; +0.010%] None None None
trace_buffer/4_senders/no_delay execution_time [2.467ms; 2.484ms] or [-0.344%; +0.344%] None None None
trace_buffer/4_senders/no_delay throughput [1449952.309op/s; 1460039.181op/s] or [-0.347%; +0.347%] None None None
trace_buffer/8_senders/10us_delay execution_time [57.856ms; 57.918ms] or [-0.054%; +0.054%] None None None
trace_buffer/8_senders/10us_delay throughput [124315.058op/s; 124449.170op/s] or [-0.054%; +0.054%] None None None
trace_buffer/8_senders/1us_delay execution_time [50.271ms; 50.285ms] or [-0.014%; +0.014%] None None None
trace_buffer/8_senders/1us_delay throughput [143183.698op/s; 143224.831op/s] or [-0.014%; +0.014%] None None None
trace_buffer/8_senders/no_delay execution_time [6.475ms; 6.528ms] or [-0.410%; +0.410%] None None None
trace_buffer/8_senders/no_delay throughput [1103685.062op/s; 1113146.953op/s] or [-0.427%; +0.427%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz fbdace3 1786121056 main
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
concentrator/add_spans_to_concentrator execution_time 9.534ms 9.569ms ± 0.018ms 9.567ms ± 0.011ms 9.578ms 9.604ms 9.611ms 9.635ms 0.71% 0.634 0.374 0.19% 0.001ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
concentrator/add_spans_to_concentrator execution_time [9.566ms; 9.571ms] or [-0.026%; +0.026%] None None None

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz fbdace3 1786121056 main
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
two way interface execution_time 20.988µs 21.567µs ± 0.281µs 21.499µs ± 0.160µs 21.700µs 22.185µs 22.343µs 22.432µs 4.34% 0.960 0.641 1.30% 0.020µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
two way interface execution_time [21.528µs; 21.606µs] or [-0.181%; +0.181%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz fbdace3 1786121056 main
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
write only interface execution_time 2.059µs 2.081µs ± 0.010µs 2.078µs ± 0.005µs 2.089µs 2.101µs 2.104µs 2.128µs 2.40% 0.995 1.285 0.49% 0.001µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
write only interface execution_time [2.080µs; 2.083µs] or [-0.068%; +0.068%] None None None

Group 3

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz fbdace3 1786121056 main
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
receiver_entry_point/report/2644 execution_time 5.161ms 5.192ms ± 0.031ms 5.187ms ± 0.008ms 5.197ms 5.225ms 5.263ms 5.549ms 6.98% 7.828 84.532 0.60% 0.002ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
receiver_entry_point/report/2644 execution_time [5.188ms; 5.196ms] or [-0.083%; +0.083%] None None None

@datadog-official

datadog-official Bot commented Aug 7, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 87.84%
Overall Coverage: 75.90% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0f4a0ae | Docs | Datadog PR Page | Give us feedback!

@brettlangdon
brettlangdon marked this pull request as ready for review August 7, 2026 13:25
@brettlangdon
brettlangdon requested a review from a team as a code owner August 7, 2026 13:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 067a252464

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

f: F,
timeout: std::time::Duration,
) -> Result<F::Output, BlockOnTimeoutError> {
self.block_on(async move { tokio::time::timeout(timeout, f).await })?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid panicking on timerless BlockingRuntime implementations

When this default is used by BasicRuntime::from_handle with a Tokio runtime built without enable_time/enable_all—a configuration that from_handle currently accepts—Tokio panics here with “timers are disabled” instead of returning BlockOnTimeoutError; the same applies to third-party BlockingRuntime implementations whose block_on is not Tokio-backed. This makes the new fallible API a potential process-aborting path when called through FFI, so missing timer support must be returned as an error or the timeout mechanism must be guaranteed by the trait.

AGENTS.md reference: AGENTS.md:L70-L76

Useful? React with 👍 / 👎.

Comment on lines +112 to +116
/// Drives `f` to completion, blocking the current thread, but gives up once `timeout`
/// elapses.
///
/// A caller can bound a wait without adding tokio as a direct dependency. This method
/// drives the deadline on the same executor as [`block_on`](Self::block_on).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not promise a hard bound for non-yielding futures

When f performs blocking work or otherwise does not return Poll::Pending, Tokio cannot poll its timer until that work finishes, so this method can remain blocked well past timeout and then return Ok. The documentation's claims that it “gives up once timeout elapses” and lets callers “bound a wait” are therefore unsafe for the generic Future accepted here; either document that the deadline is cooperative and requires the future to yield, or execute the work in a way that can enforce the bound.

Useful? React with 👍 / 👎.

@dd-octo-sts

dd-octo-sts Bot commented Aug 7, 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.19 MB 89.19 MB +0% (+24 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 8.20 MB 8.20 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.06 MB 11.06 MB 0% (0 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 100.37 MB 100.37 MB +0% (+16 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 26.63 MB 26.63 MB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 94.56 KB 94.56 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 191.43 MB 191.44 MB +0% (+8.00 KB) 👌
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 1001.70 MB 1001.74 MB +0% (+48.57 KB) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.71 MB 8.71 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 94.56 KB 94.56 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 25.62 MB 25.62 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 51.01 MB 51.01 MB 0% (0 B) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 23.22 MB 23.22 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 96.04 KB 96.04 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 196.35 MB 196.36 MB +0% (+8.00 KB) 👌
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 990.83 MB 990.88 MB +0% (+47.54 KB) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.73 MB 6.73 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 96.04 KB 96.04 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 27.55 MB 27.55 MB --.02% (-8.00 KB) 💪
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 48.56 MB 48.56 MB +0% (+2 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 79.47 MB 79.47 MB +0% (+16 B) 👌
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 9.13 MB 9.13 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 95.12 MB 95.12 MB +0% (+16 B) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.14 MB 11.14 MB 0% (0 B) 👌

Lets consumers bound a block_on wait with a deadline without adding tokio as a direct dependency — the executor is whatever the runtime already runs on. Returns BlockOnTimeoutError::TimedOut/Io to distinguish a timeout from an executor failure.
@brettlangdon
brettlangdon force-pushed the brettlangdon/block_on_timeout branch from 067a252 to 0f4a0ae Compare August 7, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant