Skip to content

feat: include user agent in headers #262

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

Closed
wants to merge 2 commits into from
Closed

Conversation

joseph-sentry
Copy link
Contributor

this will be helpful in the future for debugging customer issues since it will tell us what version of the plugins (at least the bundler core) they're using

Copy link

codecov bot commented May 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.74%. Comparing base (866e31a) to head (01ea571).

✅ All tests successful. No failed tests found.

Additional details and impacted files
Components Coverage Δ
Plugin core 98.05% <100.00%> (+<0.01%) ⬆️
Rollup plugin 8.42% <ø> (ø)
Vite plugin 8.42% <ø> (ø)
Webpack plugin 56.84% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

codecov-notifications bot commented May 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Components Coverage Δ
Plugin core 98.05% <100.00%> (+<0.01%) ⬆️
Rollup plugin 8.42% <ø> (ø)
Vite plugin 8.42% <ø> (ø)
Webpack plugin 56.84% <ø> (ø)

📢 Thoughts on this report? Let us know!

@codecov-staging
Copy link

codecov-staging bot commented May 26, 2025

Bundle Report

Changes will increase total bundle size by 299.17kB (3.94%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@codecov/bundler-plugin-core-cjs 314.01kB 81 bytes (0.03%) ⬆️
@codecov/bundler-plugin-core-esm 312.68kB 298.01kB (2031.27%) ⬆️
@codecov/nuxt-plugin-esm 3.21kB 2.36kB (275.56%) ⬆️
@codecov/vite-plugin-esm 1.24kB -5.15kB (-80.6%) ⬇️
@codecov/sveltekit-plugin-esm 3.03kB 2.13kB (239.62%) ⬆️
@codecov/solidstart-plugin-esm 3.03kB 2.08kB (219.7%) ⬆️
@codecov/remix-vite-plugin-esm 3.02kB 2.06kB (215.05%) ⬆️
@codecov/astro-plugin-esm 862 bytes -2.41kB (-73.62%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: @codecov/vite-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.ts (New) 1.24kB 1.24kB 100.0% 🚀
index.mjs (Deleted) -6.39kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/astro-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.ts (New) 862 bytes 862 bytes 100.0% 🚀
index.mjs (Deleted) -3.27kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/solidstart-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.mjs (New) 3.03kB 3.03kB 100.0% 🚀
index.d.ts (Deleted) -949 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/example-astro-app-server-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
manifest_QIp0kAiK.mjs (New) 3.34kB 3.34kB 100.0% 🚀
manifest_BUi7qRpF.mjs (Deleted) -3.34kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/example-next-15-app-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
server/middleware-*.js 873 bytes 909 bytes 2425.0% ⚠️
server/middleware-*.js -873 bytes 36 bytes -96.04%
static/Nqjx49cC8x2ynMC3ecp78/_buildManifest.js (New) 540 bytes 540 bytes 100.0% 🚀
static/Nqjx49cC8x2ynMC3ecp78/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/4-*.js (Deleted) -540 bytes 0 bytes -100.0% 🗑️
static/4-*.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/example-astro-5-app-server-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
manifest_Dw_MXVO7.mjs (New) 3.37kB 3.37kB 100.0% 🚀
manifest_B_IIwOa4.mjs (Deleted) -3.37kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/nuxt-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.mjs (New) 3.21kB 3.21kB 100.0% 🚀
index.d.ts (Deleted) -855 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/rollup-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.mts (New) 1.3kB 1.3kB 100.0% 🚀
index.d.ts (Deleted) -1.3kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/bundler-plugin-core-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.mjs (New) 312.68kB 312.68kB 100.0% 🚀
index.d.cts (Deleted) -14.67kB 0 bytes -100.0% 🗑️

Files in index.mjs:

  • ./src/utils/getPreSignedURL.ts → Total Size: 4.59kB
view changes for bundle: @codecov/example-next-app-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/-*.js (New) 224 bytes 224 bytes 100.0% 🚀
static/-*.js (New) 77 bytes 77 bytes 100.0% 🚀
static/TRBUJRFXYUU9EDR7VFLRG/_buildManifest.js (Deleted) -224 bytes 0 bytes -100.0% 🗑️
static/TRBUJRFXYUU9EDR7VFLRG/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/sveltekit-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.mjs (New) 3.03kB 3.03kB 100.0% 🚀
index.d.cts (Deleted) -891 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/remix-vite-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.mjs (New) 3.02kB 3.02kB 100.0% 🚀
index.d.ts (Deleted) -957 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/bundler-plugin-core-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.cjs 81 bytes 314.01kB 0.03%

Files in index.cjs:

  • ./src/utils/getPreSignedURL.ts → Total Size: 4.62kB
view changes for bundle: @codecov/bundle-analyzer-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.ts (New) 2.77kB 2.77kB 100.0% 🚀
cli.d.ts (New) 342 bytes 342 bytes 100.0% 🚀
index.d.mts (Deleted) -2.77kB 0 bytes -100.0% 🗑️
cli.d.mts (Deleted) -342 bytes 0 bytes -100.0% 🗑️

Copy link

codecov bot commented May 26, 2025

Bundle Report

Changes will decrease total bundle size by 294.38kB (-3.66%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@codecov/bundler-plugin-core-cjs 314.01kB 81 bytes (0.03%) ⬆️
@codecov/bundler-plugin-core-esm 14.67kB -297.93kB (-95.31%) ⬇️
@codecov/solidstart-plugin-esm 3.03kB 2.08kB (219.7%) ⬆️
@codecov/example-sveltekit-app-client-esm 727.67kB -2 bytes (-0.0%) ⬇️
@codecov/example-sveltekit-app-server-esm 984.06kB -1 bytes (-0.0%) ⬇️
@codecov/bundle-analyzer-esm 6.9kB 3.79kB (122.05%) ⬆️
@codecov/astro-plugin-esm 862 bytes -2.41kB (-73.62%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: @codecov/nuxt-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.ts (New) 855 bytes 855 bytes 100.0% 🚀
index.d.mts (Deleted) -855 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/astro-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.cts (New) 862 bytes 862 bytes 100.0% 🚀
index.mjs (Deleted) -3.27kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/example-astro-5-app-server-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
manifest_gUQnAZ63.mjs (New) 3.37kB 3.37kB 100.0% 🚀
manifest_BryNvOO2.mjs (Deleted) -3.37kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/nextjs-webpack-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.ts (New) 1.11kB 1.11kB 100.0% 🚀
index.d.cts (Deleted) -1.11kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/example-sveltekit-app-client-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
_app/immutable/chunks/entry.*.js -2 bytes 31.45kB -0.01%
view changes for bundle: @codecov/remix-vite-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.ts (New) 957 bytes 957 bytes 100.0% 🚀
index.d.cts (Deleted) -957 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/example-sveltekit-app-server-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
chunks/internal.js -1 bytes 18.48kB -0.01%
view changes for bundle: @codecov/bundle-analyzer-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.mjs (New) 3.92kB 3.92kB 100.0% 🚀
cli.mjs (New) 2.98kB 2.98kB 100.0% 🚀
index.d.ts (Deleted) -2.77kB 0 bytes -100.0% 🗑️
cli.d.ts (Deleted) -342 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/example-next-app-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
server/middleware-*.js -852 bytes 36 bytes -95.95%
server/middleware-*.js 852 bytes 888 bytes 2366.67% ⚠️
static/_HfUx-*.js (New) 77 bytes 77 bytes 100.0% 🚀
static/_HfUx-*.js (New) 224 bytes 224 bytes 100.0% 🚀
static/QXCRXQ6tj7sRTFtf-*.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
static/QXCRXQ6tj7sRTFtf-*.js (Deleted) -224 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/bundler-plugin-core-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.cjs 81 bytes 314.01kB 0.03%

Files in index.cjs:

  • ./src/utils/getPreSignedURL.ts → Total Size: 4.62kB
view changes for bundle: @codecov/example-astro-app-server-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
manifest_DdUCATHZ.mjs (New) 3.34kB 3.34kB 100.0% 🚀
manifest_QwD2XC5E.mjs (Deleted) -3.34kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/bundler-plugin-core-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.cts (New) 14.67kB 14.67kB 100.0% 🚀
index.mjs (Deleted) -312.6kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/example-next-15-app-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
server/middleware-*.js 873 bytes 909 bytes 2425.0% ⚠️
server/middleware-*.js -873 bytes 36 bytes -96.04%
static/KiYaRglrN_2SooBxJLGQn/_buildManifest.js (New) 540 bytes 540 bytes 100.0% 🚀
static/KiYaRglrN_2SooBxJLGQn/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/xCLQzoQb25b-*.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
static/xCLQzoQb25b-*.js (Deleted) -540 bytes 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/vite-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.d.mts (New) 1.24kB 1.24kB 100.0% 🚀
index.d.cts (Deleted) -1.24kB 0 bytes -100.0% 🗑️
view changes for bundle: @codecov/solidstart-plugin-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.mjs (New) 3.03kB 3.03kB 100.0% 🚀
index.d.ts (Deleted) -949 bytes 0 bytes -100.0% 🗑️

@@ -53,6 +54,7 @@ export const getPreSignedURL = async ({
}: GetPreSignedURLArgs) => {
const headers = new Headers({
"Content-Type": "application/json",
"User-Agent": `codecov-bundler_plugin/${version}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason behind using this mixed casing instead of like codecov-bundler-plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah it's not a great reason, but shelter has some code that splits out the User-Agent by '-' and indexes by 1:
user_agent.split('-')[1] so if i did codecov-bundler-plugin everything after the second - wouldn't be captured

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh got it, thanks for the context. It sounds like the current setup in shelter is a bit restrictive - thoughts on tweaking the logic there to handle User-Agent parsing more flexibly? That way, we won't be tied down by the format and can keep things cleaner going forward

Something like:
https://github.com/codecov/shelter/blob/5f7c3ecee45cc50085f8e97cc5647ca7b17f0c8b/libs/helpers.py#L611C1-L622C1
return headers["User-Agent"].split("/")[0].split("-",1)[1]

Do you know why we strip the codecov- in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤷 i don't think there's a reason necessarily, i think it was just to keep the logs more short instead of including the "codecov-" prefix in all the log context

i think it should be fine to change the shelter handling to accommodate this

@@ -7,6 +7,7 @@ import {
type Span,
} from "@sentry/core";
import { z } from "zod";
import { version } from "../../package.json" with { type: "json" };

Choose a reason for hiding this comment

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

what. Didn't know you can do this 😆

this will be helpful in the future for debugging customer issues since
it will tell us what version of the plugins (at least the bundler
core) they're using
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.

3 participants