Skip to content

feat(utils): measure utils - #1211

Merged
BioPhoton merged 7 commits into
mainfrom
feat/utils/profiler-context
Jan 14, 2026
Merged

feat(utils): measure utils#1211
BioPhoton merged 7 commits into
mainfrom
feat/utils/profiler-context

Conversation

@BioPhoton

@BioPhotonBioPhoton commented Jan 12, 2026

Copy link
Copy Markdown
Collaborator

Related to #1197

Example of how it will get used in the profiler:

exportclassProfiler<TextendsRecord<string,ActionTrack>>{constructor(options: ProfilerOptions<T>){this.ctxOf=measureCtx(options);}measure<R>(event: string,work: ()=>R,options?: MeasureOptions): R{const{ start, success, error }=this.ctxOf(event,options);start();// <= start mark 📍try{constr=work();success(r);// <= end mark 📍 + measure ✅returnr;}catch(error_){error(error_);// <= end mark 📍 + measure ❌throwerror_;}}asyncmeasureAsync<R>(event: string,work: ()=>Promise<R>,options?: MeasureOptions,): Promise<R>{const{ start, success, error }=this.ctxOf(event,options);start();// <= start mark 📍try{constr=work();success(r);// <= end mark 📍 + measure ✅returnawaitr;}catch(error_){error(error_);// <= end mark 📍 + measure ❌throwerror_;}}}constprofiler=newProfiler({track: 'Global Track',properties: [['Global:Config',`Process ID ${process.pid}`]],color: 'primary-dark',error: (error: unknown)=>({properties: [['Global:Error',`Custom Error Info: ${String(error)}`]],}),});// Your code to profile constcodeToProfile=({ fail }: {fail?: boolean}={})=>{if(fail){thrownewError('test error');}return1;};profiler.measure('app-run',codeToProfile,{color: 'primary',properties: [['Runtime:Config',`Thread ID ${threadId}`]],success: (result: unknown)=>({properties: [['Runtime:Result',String(result)]],}),error: (error: unknown)=>({properties: [['Runtime:Error',`Stack Trace: ${String((errorasError)?.stack)}`],],}),})

@nx-cloud

nx-cloudBot commented Jan 12, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit aa05123

CommandStatusDurationResult
nx run ci:code-pushup -- merge-diffs --files=/h...✅ Succeeded5sView ↗
nx run-many --targets=code-pushup --parallel=fa...✅ Succeeded1m 26sView ↗
nx run-many --targets=code-pushup --parallel=fa...✅ Succeeded12m 25sView ↗
nx run-many -t unit-test,int-test✅ Succeeded47sView ↗

☁️ Nx Cloud last updated this comment at 2026-01-14 16:57:13 UTC

@pkg-pr-new

pkg-pr-newBot commented Jan 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1211

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1211

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1211

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1211

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1211

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1211

@code-pushup/axe-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/axe-plugin@1211

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1211

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1211

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1211

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1211

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1211

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1211

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1211

commit: aa05123

@github-actions

github-actionsBot commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit baa70b5 with previous commit 7d3681c.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟢 91🟢 92↑ +1.6
Performance🔴 37🔴 36↓ −1.1
Documentation🔴 34🔴 34↑ +0.5
Bug prevention🟡 75🟡 75↓ −0.1
Axe Accessibility🟡 88🟡 88↓ −0.1
Code style🟢 99🟢 99
Security🟡 51🟡 51
Updates🟡 78🟡 78
Type Safety🟡 67🟡 67
Miscellaneous🟡 67🟡 67
Accessibility🟢 92🟢 92
Best Practices🟢 100🟢 100
SEO🟢 92🟢 92
👍 2 groups improved, 👎 1 group regressed, 👍 7 audits improved, 👎 5 audits regressed, 24 audits changed without impacting score

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟢 91🟢 92↑ +1.6
LighthousePerformance🔴 37🔴 36↓ −1.1
JSDocs coverageDocumentation coverage🔴 34🔴 34↑ +0.5

31 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
LighthouseInitial server response time was short🟩 Root document took 400 ms🟥 Root document took 770 ms↑ +93.2 %
LighthouseProperly size images🟩 0🟨 Potential savings of 5 KiB −∞ %
LighthouseSpeed Index🟥 5.9 s🟥 6.5 s↑ +10.4 %
Code coverageLine coverage🟨 86.2 %🟩 92.7 %↑ +7.5 %
LighthouseFirst Contentful Paint🟥 3.0 s🟥 3.1 s↑ +3.7 %
JSDocs coverageTypes coverage🟥 260 undocumented types🟥 265 undocumented types↑ +1.9 %
Code coverageBranch coverage🟨 87.3 %🟨 89 %↑ +1.9 %
JSDocs coverageFunctions coverage🟥 597 undocumented functions🟥 591 undocumented functions↓ −1 %
LighthouseTime to Interactive🟥 13.0 s🟥 13.0 s↓ −0.2 %
LighthouseTotal Blocking Time🟥 1,990 ms🟥 1,880 ms↓ −5.5 %
Code coverageFunction coverage🟩 93.4 %🟩 94.2 %↑ +0.8 %
JSDocs coverageVariables coverage🟥 271 undocumented variables🟥 275 undocumented variables↑ +1.5 %
LighthouseAvoids enormous network payloads🟩 Total size was 2,113 KiB🟩 Total size was 2,127 KiB↑ +0.7 %
LighthouseUses efficient cache policy on static assets🟨 31 resources found🟨 32 resources found↑ +0.9 %
LighthouseJavaScript execution time🟥 4.4 s🟥 4.1 s↓ −6.4 %
LighthouseServer Backend Latencies🟩 1,050 ms🟩 1,330 ms↑ +25.9 %
LighthouseMinimizes main-thread work🟥 8.9 s🟥 9.2 s↑ +2.6 %
LighthouseRemove duplicate modules in JavaScript bundles🟥 Potential savings of 103 KiB🟥 Potential savings of 110 KiB↑ +37.8 %
LighthouseReduce unused CSS🟥 Potential savings of 95 KiB🟥 Potential savings of 95 KiB↓ −21.7 %
LighthouseLargest Contentful Paint🟥 11.4 s🟥 11.5 s↑ +0.6 %
LighthouseReduce unused JavaScript🟥 Potential savings of 200 KiB🟥 Potential savings of 223 KiB↑ +2.8 %
LighthouseMetrics🟩 100%🟩 100%↓ −0.2 %
LighthouseMax Potential First Input Delay🟥 1,040 ms🟥 1,030 ms↓ −1.5 %
LighthouseAvoids an excessive DOM size🟥 2,399 elements🟥 2,413 elements↑ +0.6 %
LighthouseNetwork Round Trip Times🟩 0 ms🟩 10 ms↑ +101.7 %
AxeElements must only use supported ARIA attributes🟩 98 elements🟩 102 elements↑ +4.1 %
AxeARIA attributes must be used as specified for the element's role🟩 98 elements🟩 102 elements↑ +4.1 %
AxeElements must only use permitted ARIA attributes🟩 98 elements🟩 102 elements↑ +4.1 %
AxeARIA attributes must conform to valid names🟩 98 elements🟩 102 elements↑ +4.1 %
AxeInline text spacing must be adjustable with custom stylesheets🟩 43 elements🟩 46 elements↑ +7 %
AxeARIA hidden element must not be focusable or contain focusable elements🟩 203 elements🟩 205 elements↑ +1 %
AxeInteractive controls must not be nested🟩 61 elements🟩 63 elements↑ +3.3 %
JS packagesOutdated npm dev dependencies.🟨 55 outdated package versions (29 major, 19 minor, 7 patch)🟨 56 outdated package versions (29 major, 19 minor, 8 patch)↑ +1.8 %
JSDocs coverageProperties coverage🟥 24 undocumented properties🟥 23 undocumented properties↓ −4.2 %
AxeButtons must have discernible text🟩 13 elements🟩 14 elements↑ +7.7 %
AxeIDs used in ARIA and labels must be unique🟩 28 elements🟩 29 elements↑ +3.6 %

643 other audits are unchanged.

@github-actions

github-actionsBot commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit baa70b5 with previous commit 7d3681c.

💼 Project create-cli

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟢 90🟢 96↑ +5.6

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟢 90🟢 96↑ +5.6

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟨 82.5 %🟩 97 %↑ +17.7 %
Code coverageBranch coverage🟨 73.7 %🟨 87.5 %↑ +18.8 %

442 other audits are unchanged.

💼 Project nx-plugin

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟡 89🟢 91↑ +2.2

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟡 89🟢 91↑ +2.2

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟨 84.8 %🟩 93.2 %↑ +9.8 %
Code coverageBranch coverage🟨 76.3 %🟨 80.8 %↑ +6 %

446 other audits are unchanged.

💼 Project plugin-jsdocs

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟢 95🟢 97↑ +1.9

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟢 95🟢 97↑ +1.9

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟩 90.5 %🟩 96 %↑ +6.1 %
Code coverageBranch coverage🟨 87.9 %🟩 92.5 %↑ +5.2 %

442 other audits are unchanged.

💼 Project utils

🤨 Code PushUp report has both improvements and regressions.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Documentation🔴 36🔴 37↑ +1.2
Code coverage🟢 94🟢 95↑ +0.5

4 other categories are unchanged.

👍 2 groups improved, 👍 5 audits improved, 👎 1 audit regressed, 1 audit changed without impacting score

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
JSDocs coverageDocumentation coverage🔴 36🔴 37↑ +1.2
Code coverageCode coverage metrics🟢 94🟢 95↑ +0.5

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
JSDocs coverageTypes coverage🟥 59 undocumented types🟥 64 undocumented types↑ +8.5 %
JSDocs coverageFunctions coverage🟥 246 undocumented functions🟥 240 undocumented functions↓ −2.4 %
Code coverageLine coverage🟩 93.8 %🟩 97.6 %↑ +4 %
JSDocs coverageVariables coverage🟥 43 undocumented variables🟥 47 undocumented variables↑ +9.3 %
Code coverageBranch coverage🟩 91.8 %🟩 92 %↑ +0.2 %
Code coverageFunction coverage🟩 95.8 %🟩 96 %↑ +0.1 %
JSDocs coverageProperties coverage🟥 24 undocumented properties🟥 23 undocumented properties↓ −4.2 %

437 other audits are unchanged.

💼 Project cli

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟢 92🟢 94↑ +1.4

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟢 92🟢 94↑ +1.4

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟨 88.5 %🟩 94.5 %↑ +6.7 %
Code coverageBranch coverage🟨 84.2 %🟨 86.9 %↑ +3.3 %

442 other audits are unchanged.

💼 Project plugin-axe

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟢 93🟢 94↑ +1.4

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟢 93🟢 94↑ +1.4

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageBranch coverage🟨 86.3 %🟩 90.1 %↑ +4.4 %
Code coverageLine coverage🟨 69.7 %🟨 72.2 %↑ +3.6 %

441 other audits are unchanged.

💼 Project plugin-typescript

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟡 86🟡 87↑ +1.3

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟡 86🟡 87↑ +1.3

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟩 90.7 %🟩 95.5 %↑ +5.3 %
Code coverageBranch coverage🟨 77.7 %🟨 80.2 %↑ +3.3 %

442 other audits are unchanged.

💼 Project plugin-lighthouse

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟢 99🟢 99↑ +1

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟢 99🟢 99↑ +1

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟩 97.2 %🟩 99.8 %↑ +2.7 %
Code coverageBranch coverage🟩 96.2 %🟩 98.8 %↑ +2.7 %

442 other audits are unchanged.

💼 Project models

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟢 93🟢 94↑ +1

3 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟢 93🟢 94↑ +1

11 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageBranch coverage🟩 91.5 %🟩 94.2 %↑ +2.9 %
Code coverageLine coverage🟩 97.2 %🟩 99.4 %↑ +2.2 %

435 other audits are unchanged.

💼 Project ci

🤨 Code PushUp report has both improvements and regressions.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟢 92🟢 92↑ +0.9

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved, 👎 1 audit regressed

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟢 92🟢 92↑ +0.9

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟨 89.7 %🟩 94.8 %↑ +5.7 %
Code coverageBranch coverage🟨 82.4 %🟨 83.6 %↑ +1.5 %
Code coverageFunction coverage🟩 96.6 %🟩 96.6 %↓ −0.1 %

442 other audits are unchanged.

💼 Project core

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟡 90🟢 90↑ +0.8

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟡 90🟢 90↑ +0.8

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟩 91.2 %🟩 94.8 %↑ +3.9 %
Code coverageBranch coverage🟨 81.7 %🟨 83.2 %↑ +1.8 %

442 other audits are unchanged.

💼 Project plugin-coverage

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟡 89🟢 90↑ +0.7

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟡 89🟢 90↑ +0.7

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟨 85.7 %🟨 88 %↑ +2.7 %
Code coverageBranch coverage🟨 88.1 %🟨 89.6 %↑ +1.7 %

442 other audits are unchanged.

💼 Project plugin-eslint

🤨 Code PushUp report has both improvements and regressions.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟢 94🟢 94↑ +0.6

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved, 👎 1 audit regressed

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟢 94🟢 94↑ +0.6

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageLine coverage🟩 92.6 %🟩 95 %↑ +2.5 %
Code coverageBranch coverage🟨 85.2 %🟨 86.5 %↑ +1.5 %
Code coverageFunction coverage🟩 98.2 %🟩 98.2 %↓ −0.1 %

441 other audits are unchanged.

💼 Project plugin-js-packages

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Code coverage🟡 85🟡 86↑ +0.6

5 other categories are unchanged.

👍 1 group improved, 👍 2 audits improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
Code coverageCode coverage metrics🟡 85🟡 86↑ +0.6

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
Code coverageBranch coverage🟩 93.3 %🟩 95 %↑ +1.8 %
Code coverageLine coverage🟨 85 %🟨 85.8 %↑ +0.9 %

442 other audits are unchanged.

@BioPhoton
BioPhoton marked this pull request as ready for review January 12, 2026 02:45
Comment threadpackages/utils/src/lib/user-timing-extensibility-api-utils.ts Outdated
Comment threadpackages/utils/src/lib/user-timing-extensibility-api-utils.ts Outdated
Comment threadpackages/utils/src/lib/user-timing-extensibility-api-utils.unit.test.ts Outdated
BioPhotonand others added 2 commits January 14, 2026 17:26
Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
@BioPhoton
BioPhoton merged commit f3e0851 into mainJan 14, 2026
24 checks passed
@BioPhoton
BioPhoton deleted the feat/utils/profiler-context branch January 14, 2026 17:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@BioPhoton@matejchalk@hanna-skryl