-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add global state storage size logging with threshold filter #3810
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
base: main
Are you sure you want to change the base?
Conversation
Adds a utility function to log global state storage sizes with a configurable threshold filter (default 10KB) to help users identify large items. This provides visibility into which global state items are consuming significant storage space, making it easier to diagnose performance issues. Fixes: #3809 Signed-off-by: Eric Wheeler <[email protected]>
2f7ab2d
to
bcb4268
Compare
@cte @mrubens @hannesrudolph what does It looks like the intention is to prevent files that are not used, but this new file is definitely used (imported by extension.ts) and I cannot figure out how to fix this error:
|
First of all, apologies for my creepy unsolicited entrance. Creator of Knip here. Sometimes I see projects using Knip and this caught my eye. Feel free to ignore me! But I noticed that this is a monorepo and the root {
"$schema": "https://unpkg.com/knip@latest/schema.json",
"workspaces": {
".": {
"entry": ["src/extension.ts", "src/workers/countTokens.ts", "src/**/__tests__/**/*{b,B}enchmark.ts"],
"project": ["src/**/*.ts"]
},
"webview-ui": {
"entry": ["src/index.tsx"],
"project": ["src/**/*.{ts,tsx}"]
}
},
"ignore": ["**/__mocks__/**"]
} This way, there's no need to ignore as much! In the next release of Knip you'll be able to remove that Have a great day ☀️ |
@webpro, Thank you for dropping in! Do you understand what causes the following? As far as I can tell,
|
In a monorepo, the top-level Knip could def need some more config validation, etc. but we're not there yet. Btw the |
thank you I am going to reference this in a new issue |
Context
This PR adds a utility function to log global state storage sizes with a configurable threshold filter (default 10KB) to help users identify large items.
Implementation
src/utils/storageUtils.ts
with:formatBytes
function to convert byte sizes to human-readable formatlogGlobalStorageSize
function with threshold parameter (default 10KB)extension.ts
to use the new utility functionsformatBytes
functionconsole.log
instead ofoutputChannel
How to Test
Fixes #3809
Important
Adds utility to log global state storage sizes with a threshold filter and updates logging behavior in the extension.
logGlobalStorageSize
instorageUtils.ts
to log global state items exceeding a size threshold (default 10KB).extension.ts
to uselogGlobalStorageSize
during activation.outputChannel
toconsole.log
inextension.ts
.formatBytes
instorageUtils.ts
to convert byte sizes to human-readable format.formatBytes
instorageUtils.test.ts
.This description was created by
for 2f7ab2d. You can customize this summary. It will automatically update as commits are pushed.