Skip to content

Benchmark for #957#1006

Draft
szokeasaurusrex wants to merge 25 commits intoszokeasaurusrex/hubswitchguardfrom
szokeasaurusrex/hubswitchguard-bench
Draft

Benchmark for #957#1006
szokeasaurusrex wants to merge 25 commits intoszokeasaurusrex/hubswitchguardfrom
szokeasaurusrex/hubswitchguard-bench

Conversation

@szokeasaurusrex
Copy link
Member

Add a benchmark for #957

Results from my local run

  • profile: full
  • baseline: origin/master
  • candidate: szokeasaurusrex/hubswitchguard (c73d834fcde0dffc6921f1585d0d7fe83b01ff29)
scenario mode origin/master mean (ns) c73d834 mean (ns) delta
enter_exit_existing_span sentry_active 307.06 440.9 43.59%
enter_exit_existing_span tracing_only_control 9.8944 10.004 1.11%
create_enter_exit_close_span sentry_active 2272.3 2496.1 9.85%
create_enter_exit_close_span tracing_only_control 61.846 62.866 1.65%
reenter_same_span_depth2 sentry_active 2542.2 2855 12.30%
reenter_same_span_depth2 tracing_only_control 71.74 72.781 1.45%
cross_thread_shared_span sentry_active 29135 30946 6.22%
cross_thread_shared_span tracing_only_control 24959 24518 -1.77%

szokeasaurusrex and others added 25 commits February 5, 2026 14:51
Add a new method called `into_items` to the `Envelope` type. This method is similar to the existing `items` method, except that it yields owned `EnvelopeItem`s rather than references.

Also, refactor a test where we can use this new method to avoid a clone.

I intend to use this method elsewhere in the future, that is why I am adding it.
HubSwitchGuard manages thread-local hub state but was Send, allowing it
to be moved to another thread. When dropped on the wrong thread, it would
corrupt that thread's hub state instead of restoring the original thread.

To fix this, add PhantomData<MutexGuard<'static, ()>> to make the guard
!Send while keeping it Sync. This prevents the guard from being moved
across threads at compile time.

Additionally, refactor sentry-tracing to store guards in thread-local
storage keyed by span ID instead of in span extensions. This fixes a
related bug where multiple threads entering the same span would clobber
each other's guards.

Fixes #943
Refs RUST-130

Co-Authored-By: Claude <noreply@anthropic.com>
Bump the MSRV to 1.88 to allow dependency updates (see #968). I do not
think this change requires a major version bump, as our [MSRV
policy](https://github.com/getsentry/sentry-rust?tab=readme-ov-file#requirements)
states we try to support the last six months of Rust versions, and 1.88
is more than six months old.

Stacked on #969.
Bumps [time](https://github.com/time-rs/time) from 0.3.41 to 0.3.47.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/time-rs/time/releases">time's
releases</a>.</em></p>
<blockquote>
<h2>v0.3.47</h2>
<p>See the <a
href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">changelog</a>
for details.</p>
<h2>v0.3.46</h2>
<p>See the <a
href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">changelog</a>
for details.</p>
<h2>v0.3.45</h2>
<p>See the <a
href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">changelog</a>
for details.</p>
<h2>v0.3.44</h2>
<p>See the <a
href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">changelog</a>
for details.</p>
<h2>v0.3.43</h2>
<p>See the <a
href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">changelog</a>
for details.</p>
<h2>v0.3.42</h2>
<p>See the <a
href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">changelog</a>
for details.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">time's
changelog</a>.</em></p>
<blockquote>
<h2>0.3.47 [2026-02-05]</h2>
<h3>Security</h3>
<ul>
<li>
<p>The possibility of a stack exhaustion denial of service attack when
parsing RFC 2822 has been
eliminated. Previously, it was possible to craft input that would cause
unbounded recursion. Now,
the depth of the recursion is tracked, causing an error to be returned
if it exceeds a reasonable
limit.</p>
<p>This attack vector requires parsing user-provided input, with any
type, using the RFC 2822 format.</p>
</li>
</ul>
<h3>Compatibility</h3>
<ul>
<li>Attempting to format a value with a well-known format (i.e. RFC
3339, RFC 2822, or ISO 8601) will
error at compile time if the type being formatted does not provide
sufficient information. This
would previously fail at runtime. Similarly, attempting to format a
value with ISO 8601 that is
only configured for parsing (i.e. <code>Iso8601::PARSING</code>) will
error at compile time.</li>
</ul>
<h3>Added</h3>
<ul>
<li>Builder methods for format description modifiers, eliminating the
need for verbose initialization
when done manually.</li>
<li><code>date!(2026-W01-2)</code> is now supported. Previously, a space
was required between <code>W</code> and <code>01</code>.</li>
<li><code>[end]</code> now has a <code>trailing_input</code> modifier
which can either be <code>prohibit</code> (the default) or
<code>discard</code>. When it is <code>discard</code>, all remaining
input is ignored. Note that if there are components
after <code>[end]</code>, they will still attempt to be parsed, likely
resulting in an error.</li>
</ul>
<h3>Changed</h3>
<ul>
<li>More performance gains when parsing.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>If manually formatting a value, the number of bytes written was one
short for some components.
This has been fixed such that the number of bytes written is always
correct.</li>
<li>The possibility of integer overflow when parsing an owned format
description has been effectively
eliminated. This would previously wrap when overflow checks were
disabled. Instead of storing the
depth as <code>u8</code>, it is stored as <code>u32</code>. This would
require multiple gigabytes of nested input to
overflow, at which point we've got other problems and trivial
mitigations are available by
downstream users.</li>
</ul>
<h2>0.3.46 [2026-01-23]</h2>
<h3>Added</h3>
<ul>
<li>All possible panics are now documented for the relevant
methods.</li>
<li>The need to use <code>#[serde(default)]</code> when using custom
<code>serde</code> formats is documented. This applies
only when deserializing an <code>Option&lt;T&gt;</code>.</li>
<li><code>Duration::nanoseconds_i128</code> has been made public,
mirroring
<code>std::time::Duration::from_nanos_u128</code>.</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/time-rs/time/commit/d5144cd2874862d46466c900910cd8577d066019"><code>d5144cd</code></a>
v0.3.47 release</li>
<li><a
href="https://github.com/time-rs/time/commit/f6206b050fd54817d8872834b4d61f605570e89b"><code>f6206b0</code></a>
Guard against integer overflow in release mode</li>
<li><a
href="https://github.com/time-rs/time/commit/1c63dc7985b8fa26bd8c689423cc56b7a03841ee"><code>1c63dc7</code></a>
Avoid denial of service when parsing Rfc2822</li>
<li><a
href="https://github.com/time-rs/time/commit/5940df6e72efb63d246ca1ca59a0f836ad32ad8a"><code>5940df6</code></a>
Add builder methods to avoid verbose construction</li>
<li><a
href="https://github.com/time-rs/time/commit/00881a4da1bc5a6cb6313052e5017dbd7daa40f0"><code>00881a4</code></a>
Manually format macros everywhere</li>
<li><a
href="https://github.com/time-rs/time/commit/bb723b6d826e46c174d75cd08987061984b0ceb7"><code>bb723b6</code></a>
Add <code>trailing_input</code> modifier to <code>end</code></li>
<li><a
href="https://github.com/time-rs/time/commit/31c4f8e0b56e6ae24fe0d6ef0e492b6741dda783"><code>31c4f8e</code></a>
Permit <code>W12</code> in <code>date!</code> macro</li>
<li><a
href="https://github.com/time-rs/time/commit/490a17bf306576850f33a86d3ca95d96db7b1dcd"><code>490a17b</code></a>
Mark error paths in well-known formats as cold</li>
<li><a
href="https://github.com/time-rs/time/commit/6cb1896a600be1538ecfab8f233fe9cfe9fa8951"><code>6cb1896</code></a>
Optimize <code>Rfc2822</code> parsing</li>
<li><a
href="https://github.com/time-rs/time/commit/6d264d59c25e3da0453c3defebf4640b0086a006"><code>6d264d5</code></a>
Remove erroneous <code>#[inline(never)]</code> attributes</li>
<li>Additional commits viewable in <a
href="https://github.com/time-rs/time/compare/v0.3.41...v0.3.47">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=time&package-manager=cargo&previous-version=0.3.41&new-version=0.3.47)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

Fixes #985 
Fixes
[RUST-148](https://linear.app/getsentry/issue/RUST-148/rustsec-2026-0009-denial-of-service-via-stack-exhaustion)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/getsentry/sentry-rust/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This reverts commit 750dec0, which
introduced `cargo nextest` for the Rust stable tests, only (MSRV tests
have consistently used `cargo test`).

With this change, we also revert the Sentry Prevent upload.

Resolves #972
Resolves
[RUST-138](https://linear.app/getsentry/issue/RUST-138/replace-nextest-and-sentry-prevent-with-cargo-test)
Replace CI make invocations with explicit cargo commands to make
workflow behavior easier to read directly in the CI config.

Remove the root Makefile to avoid maintaining a separate command layer
in addition to the workflow definitions.

Closes GH-973
Closes
[RUST-139](https://linear.app/getsentry/issue/RUST-139/delete-the-makefile-and-remove-references)
### Description

Move RUSTFLAGS=-Dwarnings to workflow-level env in ci.yml and remove
duplicated step-level env blocks from check and MSRV jobs.

#### Issues

Closes #976
Closes
[RUST-142](https://linear.app/getsentry/issue/RUST-142/enforce-rustflags=-dwarnings-across-all-ci-jobs)
Add a single required-check aggregator job to CI.

This makes branch protection easier to manage while still enforcing the
full required CI set, and keeps `codecov` intentionally out of the gate.

Closes #977
Closes [RUST-143](https://linear.app/getsentry/issue/RUST-143/add-aggregator-required-ci-job)
Run both check and test over a shared os×rust matrix for stable and 1.88.0, and remove the standalone MSRV job to reduce drift.

Keep check permutations identical across toolchains, add explicit workspace doc-test runs in test, and retain an explicit sentry default+test feature assertion with an inline rationale comment.

Closes #974
Closes [RUST-140](https://linear.app/getsentry/issue/RUST-140/align-msrv-and-stable-ci-coverage-including-doc-tests)
Add --locked to cargo invocations in CI and weekly workflows so checks fail if Cargo.lock is out of sync.

This keeps automation aligned with reproducible dependency resolution and prevents CI from silently updating lockfile state.

Closes #982
Closes [RUST-147](https://linear.app/getsentry/issue/RUST-147/ensure-all-jobs-run-with-locked)
Configure workflow-level concurrency in ci.yml so newer runs for the same workflow+ref cancel older in-progress runs.

Use github.head_ref || github.ref to keep PR and branch pushes grouped correctly without changing any job logic.

Closes #979
Closes [RUST-145](https://linear.app/getsentry/issue/RUST-145/add-ci-concurrency-with-cancel-in-progress)
Refactor the top-level CI workflow into a thin orchestrator that calls reusable workflows for lint, check, test, and doc lanes via job-level uses.

Keep lane behavior unchanged by moving the existing matrices, commands, flags, and environment settings into the called workflows. Keep codecov inline in ci.yml and preserve the required aggregator job identity and gating behavior so required checks remain stable during the refactor.

Closes #980
Closes [RUST-146](https://linear.app/getsentry/issue/RUST-146/split-ci-into-reusable-workflows)
Run `cargo update` to bump all dependencies to the latest versions.

Stacked on #970.
## Summary

This PR migrates from the deprecated `action-prepare-release` to the new
Craft GitHub Actions.

## Changes

- Migrated `.github/workflows/release.yml` to Craft reusable workflow

## Documentation

See https://getsentry.github.io/craft/github-actions/ for more
information.

---------

Co-authored-by: Daniel Szoke <daniel.szoke@sentry.io>
### Description

Exposes `RateLimiter`, `RateLimiterCategory`, `StdTransportThread` and
`TokioTransportThread` from the `transports` module.

#### Issues

Resolves: #941

#### Reminders
- Add GH Issue ID _&_ Linear ID (if applicable)
- Add an entry to CHANGELOG.md, following the format of existing entries
- The PR title should use [Conventional
Commits](https://develop.sentry.dev/engineering-practices/commit-messages/#type)
style (`feat:`, `fix:`, `ref:`, `meta:`, etc.)
- Useful links for external contributors: [Sentry SDK development
docs](https://develop.sentry.dev/sdk/), [Discord
community](https://discord.gg/sentry)

---------

Co-authored-by: Daniel Szoke <daniel.szoke@sentry.io>
Adds `.claude/settings.json` to enable Claude Code with:
- Basic bash commands (find, ls, git, grep, mv)
- WebFetch access to GitHub and Sentry documentation sites

This follows the same pattern used in other Sentry SDK repositories like
sentry-javascript, sentry-dart, and sentry-react-native.

Note: This adds .claude/settings.json with -f flag since .claude is in
.gitignore for local settings.

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Daniel Szoke <daniel.szoke@sentry.io>
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
@szokeasaurusrex szokeasaurusrex changed the title add benchmark for #957 Benchmark for #957 Feb 24, 2026
@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- Benchmark for #957 ([#1006](https://github.com/getsentry/sentry-rust/pull/1006))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against c4f2f72

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.

4 participants