Skip to content

Conversation

@BioPhoton
Copy link
Collaborator

@BioPhoton BioPhoton commented Jan 14, 2026

Related to #1197

This PR includes:

  • Add Profiler class
  • Add API methods setEnabled, isEnabled, tracks, marker, measure, measureAsync
const profiler = new Profiler({
  prefix: 'cp',
  track: 'Main',
  trackGroup: `<✓> Code PushUp - ${serializeCommandWithArgs({
        command: process.argv[2] || 'unknown',
        args: process.argv.slice(3),
 })}`,
 color: 'primary-dark',
 error: e => ({
    properties: [['Stack Track', (e as Error)?.stack || 'Unknown']],
  }),
 tracks: {
   main: {
      track: 'Main',
    },
    pluginEslint: {
      track: 'Plugins Eslint',
      ...pluginColors,
    },
    pluginCoverage: {
      track: 'Plugins Coverage',
      ...pluginColors,
    },
    pluginAxe: {
      track: 'Plugins Axe',
      ...pluginColors,
    },
  },
});

profiler.marker('Start Profiling', {
  tooltipText: 'Code Pushup CLI started'
});

const result = profiler.measure('plugin-eslint:merge-results', () => eslintPlugin.mergeResults(results), {
    ...profiler.tracks.eslintPlugin
    color: 'secondary'
  });

const asyncResult = await profiler.measureAsync('cli:load-rc-file',
  () => api.saveData(data), {
    ...profiler.tracks.main
    color: 'primary'
  }
);

@nx-cloud
Copy link

nx-cloud bot commented Jan 14, 2026

View your CI Pipeline Execution ↗ for commit 17636b6

Command Status Duration Result
nx run ci:code-pushup -- merge-diffs --files=/h... ✅ Succeeded 5s View ↗
nx run-many --targets=code-pushup --parallel=fa... ✅ Succeeded 1m 28s View ↗
nx run-many --targets=code-pushup --parallel=fa... ✅ Succeeded 12m 59s View ↗
nx run-many -t unit-test,int-test ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-16 17:26:55 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 14, 2026

Open in StackBlitz

@code-pushup/ci

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

@code-pushup/cli

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

@code-pushup/create-cli

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

@code-pushup/core

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

@code-pushup/models

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

@code-pushup/nx-plugin

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

@code-pushup/axe-plugin

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

@code-pushup/coverage-plugin

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

@code-pushup/eslint-plugin

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

@code-pushup/js-packages-plugin

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

@code-pushup/jsdocs-plugin

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

@code-pushup/lighthouse-plugin

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

@code-pushup/typescript-plugin

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

@code-pushup/utils

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

commit: 17636b6

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 5559512 with previous commit cb4de31.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Documentation 🔴 40 🔴 42 ↑ +2.5
Performance 🔴 36 🔴 36 ↑ +0.7
Code coverage 🟢 93 🟢 93 ↑ +0.1
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
👍 3 groups improved, 👍 8 audits improved, 👎 3 audits regressed, 14 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
JSDocs coverage Documentation coverage 🔴 40 🔴 42 ↑ +2.5
Lighthouse Performance 🔴 36 🔴 36 ↑ +0.7
Code coverage Code coverage metrics 🟢 93 🟢 93 ↑ +0.1

31 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Initial server response time was short 🟥 Root document took 630 ms 🟩 Root document took 460 ms ↓ −27.3 %
JSDocs coverage Methods coverage 🟨 13 undocumented methods 🟨 13 undocumented methods  +0 %
JSDocs coverage Classes coverage 🟥 6 undocumented classes 🟥 6 undocumented classes  +0 %
Lighthouse First Contentful Paint 🟥 3.1 s 🟥 3.3 s ↑ +5.3 %
Lighthouse Total Blocking Time 🟥 2,160 ms 🟥 1,740 ms ↓ −19.2 %
Lighthouse Time to Interactive 🟥 13.0 s 🟥 12.9 s ↓ −1.2 %
JSDocs coverage Types coverage 🟥 267 undocumented types 🟥 268 undocumented types ↑ +0.4 %
Code coverage Line coverage 🟩 92.6 % 🟩 92.7 % ↑ +0.1 %
JSDocs coverage Variables coverage 🟥 267 undocumented variables 🟥 268 undocumented variables ↑ +0.4 %
Code coverage Branch coverage 🟨 89.1 % 🟨 89 % ↓ −0.1 %
Code coverage Function coverage 🟩 94.3 % 🟩 94.4 % ↑ +0.1 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,110 KiB 🟩 Total size was 2,104 KiB ↓ −0.3 %
Lighthouse Minimizes main-thread work 🟥 9.2 s 🟥 8.3 s ↓ −9.9 %
Lighthouse JavaScript execution time 🟥 4.3 s 🟥 4.1 s ↓ −5.8 %
Lighthouse Largest Contentful Paint 🟥 11.6 s 🟥 11.3 s ↓ −1.9 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 95 KiB 🟥 Potential savings of 95 KiB ↑ +56.7 %
Lighthouse Metrics 🟩 100% 🟩 100% ↓ −1.2 %
Lighthouse Remove duplicate modules in JavaScript bundles 🟥 Potential savings of 94 KiB 🟥 Potential savings of 92 KiB ↓ −31.1 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 223 KiB 🟥 Potential savings of 224 KiB ↓ −9.2 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 31 resources found ↓ −0.1 %
Lighthouse Server Backend Latencies 🟩 1,280 ms 🟩 1,210 ms ↓ −5.9 %
Lighthouse Max Potential First Input Delay 🟥 910 ms 🟥 830 ms ↓ −7.9 %
Lighthouse Network Round Trip Times 🟩 20 ms 🟩 60 ms ↑ +280.4 %
Lighthouse Speed Index 🟥 6.2 s 🟥 6.2 s ↓ −0.6 %
JSDocs coverage Properties coverage 🟥 26 undocumented properties 🟥 30 undocumented properties ↑ +15.4 %

654 other audits are unchanged.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 5559512 with previous commit cb4de31.

💼 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 🔴 42 🔴 45 ↑ +3.7
Code coverage 🟢 95 🟢 95 ↓ −0.1

4 other categories are unchanged.

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

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
JSDocs coverage Documentation coverage 🔴 42 🔴 45 ↑ +3.7
Code coverage Code coverage metrics 🟢 95 🟢 95 ↓ −0.1

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
JSDocs coverage Methods coverage 🟥 13 undocumented methods 🟨 13 undocumented methods  +0 %
JSDocs coverage Classes coverage 🟥 3 undocumented classes 🟨 3 undocumented classes  +0 %
JSDocs coverage Types coverage 🟥 65 undocumented types 🟥 66 undocumented types ↑ +1.5 %
JSDocs coverage Variables coverage 🟥 48 undocumented variables 🟥 49 undocumented variables ↑ +2.1 %
Code coverage Branch coverage 🟩 92.1 % 🟩 91.8 % ↓ −0.2 %
Code coverage Line coverage 🟩 97.7 % 🟩 97.8 % ↑ +0.1 %
Code coverage Function coverage 🟩 96.1 % 🟩 96.2 % ↑ +0.1 %
JSDocs coverage Properties coverage 🟥 23 undocumented properties 🟥 27 undocumented properties ↑ +17.4 %

436 other audits are unchanged.


13 other projects are unchanged.

@BioPhoton BioPhoton marked this pull request as ready for review January 16, 2026 15:03
Copy link
Collaborator

@matejchalk matejchalk left a comment

Choose a reason for hiding this comment

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

A well-designed and documented API 👍

BioPhoton and others added 11 commits January 16, 2026 17:52
Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
- Move generic type parameter <T> from measureCtx function to the returned function
- Update MeasureOptions parameter to use MeasureOptions<T> for proper typing
- Remove type casts in profiler measure and measureAsync methods
- Fix measureAsync to properly await work function before calling success

This change allows the type system to properly infer the result type T
throughout the measurement chain without requiring type assertions.
- Add exported MarkerOptions type for marker method parameters
- Replace inline type definition with named MarkerOptions type
- Improves API documentation and type reusability
…type

- Import ActionTrackConfigs from user-timing-extensibility-api-utils
- Replace Record<string, ActionTrackEntryPayload> with ActionTrackConfigs in type constraints
- Improves code consistency and reduces repetition
@BioPhoton BioPhoton requested a review from matejchalk January 16, 2026 17:13
@BioPhoton BioPhoton merged commit 7c069cc into main Jan 16, 2026
24 checks passed
@BioPhoton BioPhoton deleted the feat/utils/profiler-class branch January 16, 2026 17:26
Sign up for free to 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