Skip to content

Migrate chart generation to use GFM mermaid - #103

Open
ycfreeman wants to merge 11 commits into
catchpoint:masterfrom
ycfreeman:master
Open

Migrate chart generation to use GFM mermaid#103
ycfreeman wants to merge 11 commits into
catchpoint:masterfrom
ycfreeman:master

Conversation

@ycfreeman

@ycfreeman ycfreeman commented Feb 20, 2026

Copy link
Copy Markdown

Fixes: #97

tried other graphing libraries and apparently GHA comments does not support data url at all
so there's pretty much no way to host the generated graph inside an action except relying an external service

later found out apparently GFM supports latest mermaid out of the box, which has this xychart built in
so this PR just mimics the look and feel of the original graphs, live with the limitations of what mermaid can do and call it a day

Limitations

  • x axes for the line graphs with all the time labels look rubbish, so the labels are removed
  • mermaid can't happen inside a markdown table, also removed, all the graphs are now in different lines instead of inside a table
  • there's no way to do legend nicely in mermaid xychart, therefore it is moved outside and use placehold.co for the little squares

feel free to clean up the code as see fit

Summary by CodeRabbit

Release Notes

  • Improvements

    • Enhanced system performance reports with improved section organisation and clearer metric presentation.
  • Chores

    • Added comprehensive testing framework with automated test coverage for graphing functionality.
    • Updated development dependencies including TypeScript and Node type definitions to latest stable versions.

Copilot AI review requested due to automatic review settings February 20, 2026 11:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates chart generation from the Globadge API (which recently started requiring authentication) to GitHub Flavored Markdown's built-in mermaid chart support. The change addresses issue #97 where the action was failing with 403 errors due to Globadge API authentication requirements.

Changes:

  • Replaced external Globadge API calls with inline mermaid chart generation using xychart syntax
  • Added comprehensive test coverage using vitest framework for the new graphing functionality
  • Updated development dependencies including TypeScript (5.3.3 → 5.9.3) and @types/node (^16.3.3 → ^20.19.33)

Reviewed changes

Copilot reviewed 7 out of 17 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/graphing.ts New module implementing mermaid-based chart generation for line and stacked area graphs
src/statCollector.ts Refactored to use new graphing functions; removed axios-based API calls to Globadge; simplified output format
src/interfaces/index.ts Removed GraphResponse interface no longer needed after API removal
tests/graphing.test.ts New comprehensive test suite for graphing functionality using faker for deterministic test data
vitest.config.ts New vitest configuration for test runner
tsconfig.test.json New TypeScript configuration for test files
tsconfig.json Updated to exclude vitest.config.ts and test files
package.json Added vitest and @faker-js/faker as dev dependencies; updated test script; upgraded TypeScript and @types/node
package-lock.json Lock file updates for all dependency changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/graphing.ts
Comment thread src/graphing.ts
Comment thread src/graphing.ts
Comment thread src/graphing.ts
Comment thread src/graphing.ts
Comment thread src/graphing.ts
Comment thread tests/graphing.test.ts
@Trass3r

Trass3r commented Jul 22, 2026

Copy link
Copy Markdown

Thanks for this! It seems to work well, even with the dark theme.

The typical issue with Github Flavored Markdown Mermaid is that long-running workflows quickly exceed the hard-coded (?) mermaid maxTextSize limit of 50k. Plus there's $GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of 1024k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary
One idea is to use a range for the x-axis since the labels are hidden anyways, e.g. x-axis "Time" 115330 --> 144800. Then you could even enable the labels again.
The max. memory line can be compressed since it's always the same value: line [15983.23046875, 15983.23046875]
That already makes it fit into 60k for a 3h run.
Restricting the number of fractional digits for those rather large values shrinks it further.
Beyond that there's probably only sub-sampling the data.

And the memory diagram seems to only consider physical RAM, ignoring swap. I think that's inherited from the original action.

- uses: pierotofy/set-swap-space@master
  with:
    swap-size-gb: 64
               total        used        free      shared  buff/cache   available
Mem:            15Gi       1.2Gi       9.7Gi        83Mi       5.2Gi        14Gi
Swap:           63Gi          0B        63Gi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Globadge unexpectedly require authentication with a token

3 participants