Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ResponseTimeCpuInterceptor to monitor response time and CPU usage per endpoint #1379

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

cfaur09
Copy link
Contributor

@cfaur09 cfaur09 commented Nov 13, 2024

Reasoning

  • To monitor and log the response time and CPU usage for each endpoint in the application.
  • To provide warnings when response time or CPU usage exceeds specified thresholds.
  • To improve the observability and performance monitoring of the application.

Proposed Changes

  • Added a new ResponseTimeCpuInterceptor to log response time and CPU usage for each endpoint.
  • Configured the interceptor to log warnings if response time exceeds 1000ms or CPU usage exceeds 500ms.
  • Integrated the interceptor globally in the application.

How to test

  • Fast Endpoint:
    Make a request to a fast endpoint and verify that no warnings are logged.
  • Slow Endpoint:
    Make a request to a slow endpoint and verify that warnings for response time and CPU usage are logged.

@cfaur09 cfaur09 self-assigned this Nov 13, 2024
@cfaur09 cfaur09 added the feature New feature or request label Nov 13, 2024
Copy link

github-actions bot commented Nov 13, 2024

k6 load testing comparison.
Base Commit Hash: 6a03f1f
Target Commit Hash: 7333dd8

Metric Base Target Diff
AvgMax9095AvgMax9095AvgMax9095
Mex45.50449.2649.1150.6051.401645.7055.1657.28+12.97% 🔴+266.31% 🔴+12.32% 🔴+13.21% 🔴
Pool45.54536.9949.1350.5951.331642.1255.2057.21+12.72% 🔴+205.80% 🔴+12.36% 🔴+13.09% 🔴
Tokens45.63578.7549.1050.5051.761645.8055.2557.22+13.44% 🔴+184.37% 🔴+12.53% 🔴+13.31% 🔴
Transactions58.771714.1849.4651.5569.012610.1956.0159.25+17.41% 🔴+52.27% 🔴+13.24% 🔴+14.93% 🔴
Nodes46.541330.7149.1150.4852.091645.7955.2557.25+11.92% 🔴+23.68% 🔴+12.51% 🔴+13.41% 🔴
Blocks53.051630.1549.3351.4361.252126.3755.9359.29+15.45% 🔴+30.44% 🔴+13.38% 🔴+15.29% 🔴
Accounts46.15860.3849.1250.5453.211645.8455.2057.21+15.30% 🔴+91.29% 🔴+12.37% 🔴+13.20% 🔴
Test Run Duration60006.2760002.91

Legend: Avg - Average Response Time, Max - Maximum Response Time, 90 - 90th Percentile, 95 - 95th Percentile
All times are in milliseconds.

@bogdan-rosianu bogdan-rosianu self-requested a review November 13, 2024 11:05
src/main.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants