Skip to content

ci(libdatadog): comment wasm size reports on pull requests - #258

Open
rochdev wants to merge 1 commit into
mainfrom
rochdev/wasm-size-pr-comment
Open

ci(libdatadog): comment wasm size reports on pull requests#258
rochdev wants to merge 1 commit into
mainfrom
rochdev/wasm-size-pr-comment

Conversation

@rochdev

@rochdev rochdev commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • post the WASM package size report as an updatable pull request comment
  • retain Rust function names through the optimized profiling build
  • recognize crate disambiguators in current Rust symbols and reject unusable attribution data

Testing

  • node --test packages/libdatadog/test/size-report.test.js
  • yarn lint
  • npm test --prefix packages/libdatadog
  • reproduced the profiling build with the CI-pinned wasm-opt v117

Generated by Codex.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

libdatadog WASM size

Inline artifact layer Bytes KiB
Raw WASM (before Brotli) 440,664 430.3
Brotli-compressed WASM 152,750 149.2
Base64 encoding overhead 50,918 49.7
JavaScript glue/loader 21,404 20.9
Final inlined JavaScript 225,072 219.8

Raw WebAssembly sections

Section Bytes KiB Share
header 8 0.0 0.0%
type 483 0.5 0.1%
import 3,235 3.2 0.7%
function 1,183 1.2 0.3%
table 9 0.0 0.0%
memory 5 0.0 0.0%
global 27 0.0 0.0%
export 542 0.5 0.1%
element 688 0.7 0.2%
data count 3 0.0 0.0%
code 372,101 363.4 84.4%
data 62,306 60.8 14.1%
custom 74 0.1 0.0%

Code by Rust crate

Crate/function owner Bytes KiB Share
Rust standard library 67,661 66.1 18.1%
libdatadog-wasm 52,126 50.9 13.9%
libdd-trace-obfuscation 43,276 42.3 11.6%
zrip-encode 37,298 36.4 10.0%
regex-lite 26,504 25.9 7.1%
bindings / unattributed 23,430 22.9 6.3%
http 20,993 20.5 5.6%
rustc-demangle 17,576 17.2 4.7%
serde-json 12,189 11.9 3.3%
serde-transcode 8,977 8.8 2.4%
anyhow 8,395 8.2 2.2%
libdd-trace-utils 7,439 7.3 2.0%
dlmalloc 7,141 7.0 1.9%
hashbrown 4,799 4.7 1.3%
rand-chacha 4,487 4.4 1.2%
fluent-uri 3,824 3.7 1.0%
bytes 3,589 3.5 1.0%
rmp 3,562 3.5 1.0%
zrip-core 2,909 2.8 0.8%
js-sys 2,344 2.3 0.6%
zmij 2,244 2.2 0.6%
wasm-bindgen 2,215 2.2 0.6%
other crates (<2 KiB each) 11,322 11.1 3.0%

Crate ownership comes from a separate symbol-preserving build with the same size settings. Debug-name bytes are excluded; generic functions are assigned to their symbol owner.

Generated from wasm/dist/libdatadog_wasm.js.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Overall package size

Self size: 31.65 MB
Deduped: 31.65 MB
No deduping: 31.65 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------|

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@rochdev
rochdev marked this pull request as ready for review September 3, 2026 16:24
@rochdev
rochdev requested review from a team as code owners September 3, 2026 16:24

@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: 3e597b4c90

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +45 to +47
- name: Post WASM size report
if: ${{ always() && github.event_name == 'pull_request' }}
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0

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 failing fork pull requests when posting the report

For fork-originated pull requests, including Dependabot PRs, GitHub normally downgrades GITHUB_TOKEN to read-only despite the requested permissions, but this condition still runs the script and its createComment/updateComment call fails with 403. In this workflow that turns build-libdatadog red after a successful build, prevents the artifact upload, and skips both dependent libdatadog test jobs; gate commenting to PRs whose head repository is this repository, make the comment operation non-fatal, or move it into a separately privileged workflow.

Useful? React with 👍 / 👎.

Comment on lines +69 to +73
await github.rest.issues.updateComment({
...context.repo,
comment_id: previous.id,
body,
})

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 Prevent older runs from overwriting the latest size report

When a pull request receives another push while its previous build is still running, both workflow runs can update this same marker comment, and whichever run finishes last wins even if it built the older commit. Because the workflow has no concurrency control and this update does not verify that the run's SHA is still the PR head, the displayed size report can silently become stale; check the current head before updating or otherwise serialize/cancel these updates.

Useful? React with 👍 / 👎.

@BridgeAR BridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is generally pretty neat!

Just the open comments seem legit and should be addressed

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.

2 participants