Skip to content

Test: Added Clinic.js (Dynamic Analysis, Additional Tool)#98

Merged
jarchenn merged 2 commits intomainfrom
testing-clinic-js
Nov 7, 2025
Merged

Test: Added Clinic.js (Dynamic Analysis, Additional Tool)#98
jarchenn merged 2 commits intomainfrom
testing-clinic-js

Conversation

@jarchenn
Copy link
Copy Markdown

@jarchenn jarchenn commented Oct 23, 2025

Add Clinic.js Dynamic Analysis (Tool Not on Starter List) + Artifacts

Summary

This PR adds Clinic.js as a dynamic performance analysis tool for our NodeBB app and includes evidence that it was installed and successfully run on this repository.

  • Tool: Clinic.js
  • Type: Dynamic analysis (runtime performance / event loop profiling)
  • Docs: https://clinicjs.org
  • Why this tool: Not on the course starter list; targets Node.js async/event-loop bottlenecks that static tools cannot see.

Evidence of Installation (Trackable File Changes)

Choose one of the two options below (we used whichever applied):

Option A – Local Dev Dependency (preferred for trackable changes)

  • package.json and package-lock.json show:

    "devDependencies": {
      "clinic": "x.y.z"
    }
  • Added npm script for convenience:

    "scripts": {
      "clinic:doctor": "clinic doctor -- node app.js"
    }

Option B – Global Install with Log File

  • Committed clinic-artifacts/clinic-install-log.txt showing:
    • Date/time of global install
    • Output of npm list -g --depth=0 | grep clinic

We included: [state which option you used]


Evidence of Successful Run (Artifacts)

  • Committed HTML report generated by Clinic Doctor:
    • clinic-artifacts/8910.clinic-doctor.html
  • (Optional) Committed terminal output:
    • clinic-artifacts/clinic-output.txt
  • (Optional) Screenshot of the report:
    • clinic-artifacts/report-screenshot.png

Command used:

clinic doctor -- node app.js
# exercised app for ~30s, then Ctrl+C
# Clinic wrote: .clinic/8910.clinic-doctor.html
cp .clinic/8910.clinic-doctor.html clinic-artifacts/
# optional terminal output:
clinic doctor -- node app.js > clinic-artifacts/clinic-output.txt 2>&1

What Problems This Tool Can Catch

  • Event loop blocking / slow async paths
  • CPU hotspots and synchronous work on request path
  • Latency introduced by I/O or promise chains
  • Memory or GC-related stalls (with other Clinic subtools)

Customization Tried (for Evaluation)

  • Ran Clinic Doctor under default settings on NodeBB startup workload
  • Plan to re-run with clinic flame or clinic bubbleprof if Doctor suggests CPU or async profiling

Integration Ideas (for Design Doc)

  • When to run: On demand before releases or major merges (profiling is heavier)
  • Who runs it: Feature owner or QA lead on performance-sensitive changes
  • Process impact: Attach report to PRs for reference, not as a hard CI gate

Requirement Mapping (for Grading)

  • Separate testing branch created: testing-clinic-js
  • PR from testing branch → main
  • Tool is not from starter list
  • Evidence of installation (Option A or B)
  • Artifacts proving successful run (HTML report / output / screenshot)

Notes

  • NodeBB threw an EADDRINUSE: 4567 warning due to a port conflict, but Clinic still produced a valid analysis report.
  • This PR is part of the Tools Checkpoint (10 pts) for Project 3.
  • No changes to core application logic.

##Artifact Generation Commands

# Local devDependency install (Option A)
npm install --save-dev clinic
# Optional script
jq '.scripts["clinic:doctor"]="clinic doctor -- node app.js"' package.json > package.json.tmp && mv package.json.tmp package.json

# Run and capture output
clinic doctor -- node app.js > clinic-artifacts/clinic-output.txt 2>&1
# interact with app, then Ctrl+C
mkdir -p clinic-artifacts
cp .clinic/*.clinic-doctor.html clinic-artifacts/

# Global install log (Option B)
echo "Installed Clinic.js globally on $(date -u)" > clinic-artifacts/clinic-install-log.txt
npm list -g --depth=0 | grep clinic >> clinic-artifacts/clinic-install-log.txt

# Commit and push
git add clinic-artifacts/ package.json package-lock.json
git commit -m "Add Clinic.js dynamic analysis (not on starter list) + report artifacts"
git push -u origin testing-clinic-js

Overall View demonstrating Clinic in repository as well as the HMTL report generated

Screenshot 2025-10-23 at 2 01 00 PM # HTML generated from Clinic Screenshot 2025-10-23 at 2 01 08 PM

Folder location for Clinic files

Screenshot 2025-10-23 at 2 01 13 PM Screenshot 2025-10-23 at 2 01 23 PM Screenshot 2025-10-23 at 2 02 18 PM

@coveralls
Copy link
Copy Markdown

coveralls commented Oct 23, 2025

Pull Request Test Coverage Report for Build 18957148787

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 55 unchanged lines in 6 files lost coverage.
  • Overall coverage decreased (-0.01%) to 78.447%

Files with Coverage Reduction New Missed Lines %
src/admin/versions.js 1 87.88%
src/controllers/admin/dashboard.js 2 85.34%
src/controllers/admin/plugins.js 2 90.57%
src/middleware/render.js 2 78.89%
src/emailer.js 23 75.15%
src/meta/build.js 25 53.26%
Totals Coverage Status
Change from base Build 18755099280: -0.01%
Covered Lines: 24896
Relevant Lines: 29877

💛 - Coveralls

@jarchenn jarchenn changed the title Add Clinic.js dynamic analysis report (not from starter list) Test: Add Clinic.js (Dynamic Analysis) Oct 24, 2025
@jarchenn jarchenn self-assigned this Oct 24, 2025
@jarchenn jarchenn added the documentation Improvements or additions to documentation label Oct 24, 2025
@jarchenn jarchenn changed the title Test: Add Clinic.js (Dynamic Analysis) Test: Added Clinic.js (Dynamic Analysis) Oct 24, 2025
@joon0429 joon0429 changed the title Test: Added Clinic.js (Dynamic Analysis) Test: Added Clinic.js (Dynamic Analysis, Additional Tool) Oct 24, 2025
@jarchenn jarchenn merged commit 716af64 into main Nov 7, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants