Skip to content

Add note about how to preserve debug symbols in Rust #21347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lukevalenta
Copy link
Contributor

Summary

Add note about how to preserve debug symbols in Rust when profiling.

Screenshots (optional)

Without debug symbols:
Screenshot 2025-04-02 at 5 15 29 PM

With debug symbols:
Screenshot 2025-04-02 at 5 15 42 PM

Documentation checklist

Copy link
Contributor

hyperlint-ai bot commented Apr 2, 2025

Howdy and thanks for contributing to our repo. The Cloudflare team reviews new, external PRs within two (2) weeks. If it's been two weeks or longer without any movement, please tag the PR Assignees in a comment.

We review internal PRs within 1 week. If it's something urgent or has been sitting without a comment, start a thread in the Developer Docs space internally.


PR Change Summary

Added instructions for preserving debug symbols in Rust when profiling.

  • Included a note on configuring Cargo.toml to preserve DWARF debug symbols for Rust Workers.
  • Updated instructions for using the dev profile in wrangler.toml to maintain debug symbols.

Modified Files

  • src/content/docs/workers/observability/dev-tools/cpu-usage.mdx

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

@lukevalenta lukevalenta force-pushed the lvalenta/rust-dev-tools branch from cc965dc to c69139e Compare April 3, 2025 11:57
@kodster28
Copy link
Contributor

Howdy @lukevalenta, tagged @ToriLindsay to help with this.

Also gave you write perms on our repo so -- once it's approved -- you should be able to merge in yourself.

@@ -32,6 +32,24 @@ To generate a CPU profile:

You now have a CPU profile.

:::note

For Rust Workers, add the following to your `Cargo.toml` to preserve [DWARF](https://dwarfstd.org/) debug symbols (from [this comment](https://github.com/rustwasm/wasm-pack/issues/1351#issuecomment-2100231587)):
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @lukevalenta 👋 Is wasm an industry standard that we trust? It can be tricky to use external dependencies like that in the docs if it could be subject to change or even become malware. If not, is there some more general advice we can provide instead? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @ToriLindsay, Web Assembly (wasm) is the the glue that allows us to run any compiled language (like Rust, Go, or C on Workers (see https://developers.cloudflare.com/workers/runtime-apis/webassembly/), so this PR isn't suggesting to add any external dependencies that aren't already present.

(cc @zebp or @irvinebroque)

Copy link
Contributor

Choose a reason for hiding this comment

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

@lukevalenta Ah ok. I didn't recognize the acronym. Thanks for the clarification! I'll approve.

@@ -32,6 +32,24 @@ To generate a CPU profile:

You now have a CPU profile.

:::note

For Rust Workers, add the following to your `Cargo.toml` to preserve [DWARF](https://dwarfstd.org/) debug symbols (from [this comment](https://github.com/rustwasm/wasm-pack/issues/1351#issuecomment-2100231587)):
Copy link
Contributor

Choose a reason for hiding this comment

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

@lukevalenta Ah ok. I didn't recognize the acronym. Thanks for the clarification! I'll approve.

@lukevalenta lukevalenta merged commit c58fd14 into cloudflare:production Apr 15, 2025
6 checks passed
@lukevalenta lukevalenta deleted the lvalenta/rust-dev-tools branch April 15, 2025 14:32
RebeccaTamachiro pushed a commit that referenced this pull request Apr 21, 2025
* Add note about how to preserve debug symbols in Rust

* Update src/content/docs/workers/observability/dev-tools/cpu-usage.mdx

Co-authored-by: ToriLindsay <[email protected]>

---------

Co-authored-by: ToriLindsay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product:workers Related to Workers product size/s
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants