Skip to content

chore: Add size-limit check on Pull Requests#6706

Open
JPeer264 wants to merge 1 commit into
open-telemetry:mainfrom
JPeer264:jp/size-limit
Open

chore: Add size-limit check on Pull Requests#6706
JPeer264 wants to merge 1 commit into
open-telemetry:mainfrom
JPeer264:jp/size-limit

Conversation

@JPeer264
Copy link
Copy Markdown
Member

@JPeer264 JPeer264 commented May 13, 2026

Which problem is this PR solving?

Step 1 of #6639

This introduces .size-limit, a way to detect if the bundle size is increasing or not. gzip is enabled, as everywhere where bundle size matters gzip is used - so it is more visible how it is really affecting a real-world scenario.

This GitHub action runs on every PR and on main. The action itself is then checking against the PR base branch and checks if something increased or decreased.

In this PR it would fail as it seems it needs to have size-limit installed on main, as it checks in the same PR against the PRs base branch

I didn't include any limit in the .size-limit.json as for now it should basically just give some information about the size itself.

Short description of the changes

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature, but for PRs (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested manually. As explained above, it seems that in this PR it fails on the second check of the compare step. The first size check (against this PR) shows the actual stats, and fails on the main step. Output:

[
  {
    "name": "@opentelemetry/api",
    "size": 3416
  },
  {
    "name": "@opentelemetry/api (full)",
    "size": 4669
  },
  {
    "name": "@opentelemetry/core",
    "size": 279
  },
  {
    "name": "@opentelemetry/core (full)",
    "size": 7839
  },
  {
    "name": "@opentelemetry/semantic-conventions",
    "size": 67
  },
  {
    "name": "@opentelemetry/semantic-conventions (full)",
    "size": 12642
  }
]

Checklist:

(Not sure if one of the following can be applied for this PR)

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@JPeer264 JPeer264 requested review from a team as code owners May 13, 2026 13:09
@JPeer264 JPeer264 marked this pull request as draft May 13, 2026 13:11
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.83%. Comparing base (86c621d) to head (7869769).
⚠️ Report is 60 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6706      +/-   ##
==========================================
- Coverage   95.74%   94.83%   -0.92%     
==========================================
  Files         375      376       +1     
  Lines       12823    12711     -112     
  Branches     3056     2888     -168     
==========================================
- Hits        12277    12054     -223     
- Misses        546      657     +111     

see 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JPeer264 JPeer264 marked this pull request as ready for review May 13, 2026 13:28
@pichlermarc
Copy link
Copy Markdown
Member

nice, almost there :)
looks like we still need a config

logs:

/opt/hostedtoolcache/node/22.22.2/x64/bin/npx size-limit --json
Install Size Limit preset depends on type of the project

For application, where you send JS bundle directly to users
  npm install --save-dev @size-limit/preset-app

For frameworks, components and big libraries
  npm install --save-dev @size-limit/preset-big-lib

For small (< 10 kB) libraries
  npm install --save-dev @size-limit/preset-small-lib

Check out docs for more complicated cases
  https://github.com/ai/size-limit/

@pichlermarc
Copy link
Copy Markdown
Member

or is the failure reason the one you mentioned in the PR description? 🤔

@JPeer264
Copy link
Copy Markdown
Member Author

or is the failure reason the one you mentioned in the PR description?

Yes exactly. Because it is running against main, where nothing is installed it gives you instructions on how to add it. The first /opt/hostedtoolcache/node/22.22.2/x64/bin/npx size-limit --json ran against this branch where it was successful and printed everything, the second command ran against main where it was failing and printed instructions on how to add it.

Tbh, it's quite a tough 🐥 🥚 problem for the library to solve.

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