Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add process info diagnostic for cpu, memory, and system metrics#10204

Open
GiladShoham wants to merge 2 commits intomasterfrom
feat/diagnostic-process-info
Open

feat: add process info diagnostic for cpu, memory, and system metrics#10204
GiladShoham wants to merge 2 commits intomasterfrom
feat/diagnostic-process-info

Conversation

@GiladShoham
Copy link
Member

Add getProcessInfo diagnostic that reports process uptime, pid, memory usage, CPU usage, and system info (total/free memory, CPU count, load average, hostname). Registered alongside getBitVersion in the diagnostic slot. Includes unit tests.

Copilot AI review requested due to automatic review settings February 23, 2026 08:33
Copy link
Contributor

Copilot AI left a comment

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 adds a new getProcessInfo diagnostic function to report detailed process and system metrics alongside the existing getBitVersion diagnostic. The function collects process uptime, PID, memory usage, CPU usage, and system information (total/free memory, CPU count, load average, hostname). Comprehensive unit tests are included to validate the new functionality.

Changes:

  • Added getProcessInfo static method to DiagnosticMain class that collects process and system metrics
  • Registered getProcessInfo alongside getBitVersion in the diagnostic slot
  • Updated diagnostic route verb from READ to WRITE and added explicit return statement
  • Disabled GraphQL diagnostic resolver (returns empty object instead of diagnostic data)
  • Added comprehensive unit tests for both getBitVersion and getProcessInfo methods

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
scopes/harmony/diagnostic/diagnostic.spec.ts New test file with comprehensive tests for getBitVersion and getProcessInfo functions
scopes/harmony/diagnostic/diagnostic.main.runtime.ts Added getProcessInfo method and registered it in the provider
scopes/harmony/diagnostic/diagnostic.route.ts Changed verb to WRITE and added explicit return to res.json
scopes/harmony/diagnostic/diagnostic.graphql.ts Commented out diagnostic data retrieval, now returns empty object

method = 'GET';
route = '/_diagnostic';
verb = Verb.READ;
verb = Verb.WRITE;
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The verb should be Verb.READ instead of Verb.WRITE. The /_diagnostic endpoint only reads diagnostic data without modifying any state. Based on the codebase patterns:

  • Verb.READ is used for GET requests that query data without side effects (e.g., fetch routes, search routes, query routes)
  • Verb.WRITE is used for POST requests that modify state (e.g., create, delete, put routes)

This is a GET request that only reads diagnostic information, so it should use Verb.READ.

Suggested change
verb = Verb.WRITE;
verb = Verb.READ;

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +19
// return this.diagnosticMain.getDiagnosticData();
return {};
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The GraphQL resolver for _diagnostic has been commented out and now returns an empty object. This breaks the GraphQL API functionality. If the intention is to disable this temporarily, it should either be removed completely or have a clear explanation/TODO comment. If this is intentional and permanent, the schema and resolver should be removed entirely.

This change is not mentioned in the PR description and appears to be unrelated to adding the getProcessInfo diagnostic function.

Copilot uses AI. Check for mistakes.
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.

2 participants