Skip to content

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

@italojs

Description

@italojs

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:

  • Enhanced Performance Analysis: Developers gain access to detailed performance data (CPU utilization, memory usage, event loop latency, function execution times), facilitating identification of bottlenecks and code optimization.

  • Real-time Monitoring: Developers can monitor application performance in real-time, enabling timely detection of degradation or anomalies, particularly beneficial for high-performance and responsive applications.

  • Optimization Opportunities: Performance data empowers developers to pinpoint areas for code optimization, resulting in faster and more efficient applications.

Use Scenarios:

  • Identifying Slow Routes: Performance Measurement APIs help identify routes or endpoints with longer processing times, allowing optimization for improved response times.

  • Optimizing CPU-bound Operations: Measure CPU utilization, identify CPU-intensive operations, and optimize algorithms or consider parallelization strategies for improved performance.

  • Monitoring Memory Usage: Track memory consumption, detect memory leaks, and optimize memory allocation and deallocation for efficient memory management.

  • Analyzing Event Loop Performance: Gain insights into event loop latency and execution times of event loop handlers, optimizing event-driven applications and ensuring timely event processing.

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 #55

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions