-
Notifications
You must be signed in to change notification settings - Fork 21
feat: add stats tracking for pacote.extract #618
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: master
Are you sure you want to change the base?
feat: add stats tracking for pacote.extract #618
Conversation
🦋 Changeset detectedLatest commit: 468dd7a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
workspaces/tarball/src/tarball.ts
Outdated
| }; | ||
| } | ||
|
|
||
| type ExtractFunction = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would rename it PacoteProvider and use an interface with the method extract
workspaces/scanner/src/depWalker.ts
Outdated
| pacoteProvider: { | ||
| extract: async(spec: string, dest: string, opts: pacote.Options) => { | ||
| await statsCollector.track( | ||
| `pacote.extract[${spec}]`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pacote.extract[${spec}] -> pacote.extract ${spec}
It’s the same pattern in the two other examples
02daaed to
3483f28
Compare
workspaces/scanner/src/depWalker.ts
Outdated
|
|
||
| const pacoteProvider: PacoteProvider = { | ||
| extract: async(spec, dest, opts) => { | ||
| await statsCollector.track( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don’t need the async await syntax since you don’t need the awaited result in this function
| spec: string, | ||
| destination: string, | ||
| options: pacote.Options | ||
| ): Promise<any>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The retuned type should be the same returned type than pacote.extract or void but not any
This PR adds lightweight stats tracking for
pacote.extractby injecting a tracked extract function.This helps identify slow package extractions and potential bottlenecks during scans.
No breaking changes - existing code works as-is.
Closes #615