herbsjs / herbs

A domain-first framework. Code your domain and your infrastructure will follow
https://herbsjs.org/
MIT License
427 stars 14 forks source link

Implement Performance Measurement APIs from Node.js in AuditTrail for HerbsJS Framework #64

Open italojs opened 1 year ago

italojs commented 1 year ago

In this issue I would like to discuss usage ideas before implement it

Feature affected: Audit trail feature

New Performance Measurement APIs introduced in Node.js These APIs provide insights into the performance of applications.

This issue proposes the implementation of the Performance Measurement APIs in the AuditTrail module of HerbsJS, enabling developers to seamlessly monitor and measure the performance of their applications.

Benefits:

Use Scenarios:

In conclusion, implementing the Performance Measurement APIs from Node.js 20v in the AuditTrail module of HerbsJS will empower developers to analyze and optimize the performance of their applications more effectively.

Audit trail example: json

{
    configuration:{output: {return: false, user: false}}
    description:'A use case'
    elapsedTime:362700n
    request: null
    steps: [ {
          type: 'step', 
          description: 'A step',
           return: {Ok: ''},
           metrics: {...}
    }, 
    metrics: {...} 
    elapsedTime: 76100n
    }],
    transactionId:'cfd88c2b-1d34-4c81-a07c-ac4ea5420d04'
    type:'use case'
}

Inside metrics we could collect everything we need from https://nodejs.org/api/perf_hooks.html

It could be activated by using an env var: APM=true npm run start all the data could be provided in herbsshelf like this another issue requires https://github.com/herbsjs/herbs/issues/55

italojs commented 1 year ago

We could add a page to herbsShelf like this https://github.com/RafalWilinski/express-status-monitor